Skip to content

Commit 6373e53

Browse files
committed
flatten and remove ifelse due to early returns
Signed-off-by: Niklas Hansson <niklas.sven.hansson@gmail.com>
1 parent f91df87 commit 6373e53

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

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)