[KernelGen][MThreads] Add im2col Moore Threads specialized operator - #251
Conversation
|
/test | im2col:mthreads |
❌ On-demand test failedOperator: The test failed to complete. Check the workflow run for details. |
|
/test | im2col:mthreads |
Dongxu-H
left a comment
There was a problem hiding this comment.
PR contains large infrastructure changes (removing CODEOWNERS, modifying workflows, adding image-builder and sync-to-kernelgen workflows) that should not be mixed with operator implementation. Infrastructure changes should be submitted as separate PR. Only operator-specific changes should remain: src/flag_gems/runtime/backend/_mthreads/ops/im2col.py and tests/test_im2col.py.
|
/test | im2col:mthreads |
1 similar comment
|
/test | im2col:mthreads |
ebc5d04 to
695610b
Compare
Dongxu-H
left a comment
There was a problem hiding this comment.
CI failures detected: backend-tests (mthreads-musa520) and python-op failed. Please verify the test results on MThreads device match the PR description (48 cases pass).
[KernelGen][MThreads] Add im2col Moore Threads specialized operator
Summary
Add a Moore Threads (MUSA) specialized Triton kernel for
im2col, overriding the generic implementation viaruntime.replace_customized_ops(). The kernel gathers sliding local blocks into columns with a 2D tiled grid (tiling over theC*kH*kWrows and theoutH*outWcolumns) and autotunedBLOCK_M/BLOCK_N. All index arithmetic is done in int64 to stay correct on large tensors.Testing
tests/test_im2col.py(-m im2col)GEMS_MTHREADS IM2COLdebug logtests/test_im2col.pyhard-coded@pytest.mark.skipif(not torch.cuda.is_available()), which vacuously skips all cases on non-CUDA vendors (MUSA). Replaced it with the device-agnosticflag_gems.runtime.device.device_count == 0guard, so the tests actually run on Moore Threads while remaining unchanged for CUDA.Performance
Compared against the generic FlagGems implementation on Moore Threads (MUSA).
im2col
Files Changed
src/flag_gems/runtime/backend/_mthreads/ops/im2col.py: Moore Threads Triton kernel + fallbacksrc/flag_gems/runtime/backend/_mthreads/ops/__init__.py: Register import and__all__tests/test_im2col.py: device-agnostic skip guard so the tests run on non-CUDA vendors