[FEATURE] NKI interpreter - #206
Conversation
Yes. I have dropped some comments, but haven't finished reviewing all files. |
|
Some tests in CI is not working. Please fix. |
…ols/triton-viz into nki/patch-dsl
a6d38b9 to
de93383
Compare
|
@mark14wu We need to merge this asap to start code clean up and move towards v3.0 |
|
|
||
| launches: list[Launch] = [] | ||
|
|
||
| T = TypeVar("T") |
There was a problem hiding this comment.
Where is T used in this file?
| else: | ||
| raise ValueError(f"Unknown backend: {backend}") | ||
|
|
||
| # Handle NKI functions specifically |
There was a problem hiding this comment.
if backend == "nki", the function decorator will return at line 177 and line 186 to 193 will never be executed.
| else: | ||
| raise ValueError(f"Unknown backend: {backend}") | ||
|
|
||
| # Handle NKI functions specifically |
There was a problem hiding this comment.
if backend == "nki", the function decorator will return at line 177 and line 186 to 193 will never be executed.
| def _extract_user_frames() -> list[traceback.FrameSummary]: | ||
| stack: list[traceback.FrameSummary] = list(traceback.extract_stack()) | ||
| # drop current frames (this function and callers) | ||
| stack = stack[:-2] |
There was a problem hiding this comment.
Maybe we should lift the _extract_user_frames function as a utility, put it somewhere like utils.py and reuse it in both sanitizer and tracer.
| def _extract_user_frames() -> list[traceback.FrameSummary]: | ||
| stack: list[traceback.FrameSummary] = list(traceback.extract_stack()) | ||
| # drop current frames (this function and callers) | ||
| stack = stack[:-2] |
There was a problem hiding this comment.
What I mean is _get_traceback_info() in sanitizer.py
| call_path: list[traceback.StackSummary] = field(init=False, default_factory=list) | ||
| call_path: list[traceback.FrameSummary] = field(init=False, default_factory=list) | ||
|
|
||
| def __post_init__(self): |
There was a problem hiding this comment.
Why we extract call path in __post_init__?
| def _extract_user_frames() -> list[traceback.FrameSummary]: | ||
| stack: list[traceback.FrameSummary] = list(traceback.extract_stack()) | ||
| # drop current frames (this function and callers) | ||
| stack = stack[:-2] |
There was a problem hiding this comment.
Please at least move those _extract_user_frames into clients/utils.py.
| def _extract_user_frames() -> list[traceback.FrameSummary]: | ||
| stack: list[traceback.FrameSummary] = list(traceback.extract_stack()) | ||
| # drop current frames (this function and callers) | ||
| stack = stack[:-2] |
|
Before merging, let me fix the conflicts. |
sorry for big diff :(
Adds the NKI frontend to Triton-Viz:
nki.py)nki_extract_slice.py)nki_masked_load.py)backend(one of "nki" or "triton") as arguments for patching (modifiespatch.py,client.py)data.py,tracer.py)trace.py)Added Tests
nki-examples/: demo programs to try out the visualizer (currently, onlynki-examples/matmul.pyis supported)tests/test_nki.py: basic NDArray slicingtests/test_masked_load.py: make sure masked load/store works correctly