Skip to content

Commit 8273ce2

Browse files
committed
flatten and remove ifelse due to early returns
1 parent 6a773b6 commit 8273ce2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/cuda/tile/_ir/ops_utils.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,13 @@ def memory_order_has_release(memory_order: MemoryOrder):
188188
def get_dtype(ty: TileTy | datatype.DType | LooselyTypedScalar) -> datatype.DType | PointerTy:
189189
if isinstance(ty, TileTy):
190190
return ty.dtype
191-
elif isinstance(ty, datatype.DType):
191+
if isinstance(ty, datatype.DType):
192192
return ty
193-
elif isinstance(ty, PointerTy):
193+
if isinstance(ty, PointerTy):
194194
return ty
195-
elif isinstance(ty, LooselyTypedScalar):
195+
if isinstance(ty, LooselyTypedScalar):
196196
return typeof_pyval(ty.value)
197-
else:
198-
raise TypeError(f"Cannot get dtype from {ty}")
197+
raise TypeError(f"Cannot get dtype from {ty}")
199198

200199

201200
def change_dtype(ty: TileTy | datatype.DType | PointerTy,

0 commit comments

Comments
 (0)