Skip to content

Commit 021641c

Browse files
njriasanfacebook-github-bot
authored andcommitted
Update TritonParse to disable warning on Triton language element type arguments
Summary: Disables a warning generated if you pass a dtype (e.g. `tl.float32`) into a TritonBench kernel as a constexpr. This is needed for expanding the warp spec examples to allow for different data types. Reviewed By: FindHao Differential Revision: D77948317 fbshipit-source-id: 68bca8669e34618033ea37ad173452114a180d59
1 parent 1a0b350 commit 021641c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tritonparse/structured_logging.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ def convert(obj):
142142
Returns:
143143
A serializable version of the input object where dataclasses are converted to dictionaries
144144
"""
145+
from triton.language.core import dtype
146+
145147
# 1. primitives that JSON already supports -------------------------------
146148
if obj is None or isinstance(obj, (bool, int, str)):
147149
return obj
@@ -176,6 +178,11 @@ def convert(obj):
176178
return convert(
177179
asdict(obj)
178180
) # Convert dataclass to dict and then process that dict
181+
182+
# 4. Common Triton constexpr objects
183+
if isinstance(obj, dtype):
184+
return f"triton.language.core.dtype('{str(obj)}')"
185+
179186
log.warning(f"Unknown type: {type(obj)}")
180187
return str(obj) # Return primitive types as-is
181188

0 commit comments

Comments
 (0)