Commit 86fa46b
Add support for Triton dtype parameters in reproducer
Summary:
Add support for parsing and handling Triton dtype parameters (like `tl.bfloat16`, `tl.float16`) in TritonParse reproducer scripts.
**Problem**:
TritonParse reproducer scripts failed when Triton kernels had dtype parameters (e.g., `ab_dtype`, `c_dtype`), showing "Warning: Unhandled argument type 'dtype'. Returning None" and passing `None` instead of the actual dtype object like `tl.bfloat16`.
**Solution**:
1. Added `TRITON_DTYPE_MAP` dictionary mapping dtype string representations (e.g., 'bf16') to Triton dtype objects (e.g., `tl.bfloat16`)
2. Added dtype handling branch in `_create_arg_from_info()` to parse dtype arguments
3. Updated function extractor to include triton.language import and TRITON_DTYPE_MAP in generated reproducers
The mapping covers all Triton dtypes:
- Signed/unsigned integers: int1, int8-64, uint8-64
- Standard floating point: fp16, bf16, fp32, fp64
- FP8 variants: fp8e4b15, fp8e4nv, fp8e4b8, fp8e5, fp8e5b16
**Impact**:
Future generated reproducer scripts will correctly handle dtype parameters, allowing kernels with dtype arguments to run successfully.
Reviewed By: htyu
Differential Revision: D87575372
fbshipit-source-id: b68e1c14a4945fd73c73d434267aa95f9a7db3331 parent 984089b commit 86fa46b
2 files changed
+42
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
| |||
218 | 223 | | |
219 | 224 | | |
220 | 225 | | |
| 226 | + | |
221 | 227 | | |
222 | 228 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
22 | 50 | | |
23 | 51 | | |
24 | 52 | | |
| |||
322 | 350 | | |
323 | 351 | | |
324 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
325 | 361 | | |
326 | 362 | | |
327 | 363 | | |
| |||
0 commit comments