Skip to content

Commit

Permalink
[FRONTEND] fix the hard code builder.arch that could block third_part…
Browse files Browse the repository at this point in the history
…y tests (triton-lang#1859)

For CUDA devices, the `builder.arch` is an int.
For third_party devices, this line would be a TypeError. For example:

```
TypeError: '<' not supported between instances of 'dict' and 'int'
```

Co-authored-by: Wang Weihan <[email protected]>
  • Loading branch information
Stonepia and EikanWang authored Jul 12, 2023
1 parent bf5acf4 commit d50e32f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/triton/language/semantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,11 @@ def bitcast(input: tl.tensor,
dst_ty)


# TODO: architecture descriptor class
def _is_cuda(arch):
return isinstance(arch, int)


def cast(input: tl.tensor,
dst_ty: tl.dtype,
builder: ir.builder) -> tl.tensor:
Expand All @@ -677,7 +682,7 @@ def cast(input: tl.tensor,
src_sca_ty = src_ty.scalar
dst_sca_ty = dst_ty.scalar

if builder.arch < 89 and \
if _is_cuda(builder.arch) and builder.arch < 89 and \
(src_sca_ty.is_fp8e4() or dst_sca_ty.is_fp8e4()):
warnings.warn("Standard tl.float8e4 format will be deprecated on SM < 89. "
"Please use tl.float8e4b15.", DeprecationWarning)
Expand Down

0 comments on commit d50e32f

Please sign in to comment.