Repository navigation
[HIP] [JIT] [Build] Export ctypes entry points on Windows and add a JIT op smoke test - #6273
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
|
Thanks for turning this around so quickly, and for answering both asks in one PR. The ROCm 10.1 + Python 3.13 result is exactly what we needed — that combination was the single biggest unknown in our CI plan, and it's now settled. Reviewed the whole diff. The export fix is right and the test reads well. A few notes, none blocking. The export bug is real and your diagnosis is the correct one. PE exports nothing without Six bare On the test. The things I was most worried about, you've handled:
And it measures no performance, which sidesteps a problem you may not have hit: the Windows torch wheels are built without Kineto, so Two small suggestions:
On One coordination note. Xin hit the same export bug independently while building out the Windows CI job in #6242, and fixed three of the same four sites there. Yours is the superset and also carries the harness, so I'll ask him to drop the Only full CI hasn't run here yet — it's a fork PR, so the workflows need a maintainer to kick them off. I'll do that, and assuming it's green this is good to merge. One question, not blocking: your card is gfx1200 and the runners we're targeting are gfx1201. Same RDNA4 family and the same toolchain, so I don't expect a difference, but did anything in your run depend on the specific target beyond |
|
One more thing you may be better placed to settle than we are, if you have the time and the appetite. We don't actually know which aiter ops work on RDNA4 — and that gap is not a Windows one. aiter exports 327 Your machine is the cheapest place to turn that into a real list. Would you be willing to run these 21 and report what passes? That is everything under Two things worth knowing before you start. Nineteen of the twenty-one are argparse scripts rather than pytest files, and ten define A failure here is information, not a problem to fix. What we want out of it is the split between "this op has no RDNA4 implementation", which is expected and not a Windows issue, and "this op should work and doesn't", which is a real bug. Even a partial list — say the first handful you get through — would be more than exists today. No obligation at all, and this is clearly separate from the PR, which stands on its own. If you'd rather not, we'll run it in CI once the job is up; it will just take longer and cost more runner time than it would on your desk. |
|
@gyohuangxin over to you to review and merge this one. Context in case it saves you time: the only red check is Two non-blocking suggestions are open with the author (a Once this lands you can drop the three |
b95cb75 to
d4ff6d8
Compare
|
Thanks for the review. Updates:
I ran the 21 op tests. Two failures were aiter bugs on Windows, and those fixes are now in this PR: merged tuned-config paths were joined with
|
|
@gyohuangxin the test is now under |
The Windows ROCm torch wheels are built without Kineto. torch.profiler still
runs there, but records no device events, so get_trace_perf finds an empty
device frame and returns 0. Every op test that reports a duration prints
0.00 us, and the ones that divide to show an uplift print nan -- visible in
the Windows CI run of test_rmsnorm2d.py as
[perf] torch avg: 0.00 us, ck avg: 0.00 us, uplift: nan%
test_rmsnorm2d.py:93: RuntimeWarning: invalid value encountered in scalar divide
122 of the 166 files under op_tests/ go through perftest or run_perftest, so
this is most of the suite. The same gap was hit independently in ROCm/FlyDSL
PR #1239, whose author reports the pytest performance wrapper not completing
"because Torch Kineto's DataFrame field is unavailable".
perftest already has a use_cuda_event path that times with torch.cuda.Event
and never touches the profiler; five call sites pass it explicitly. Probe for
Kineto once and take that path automatically when it is missing, rather than
handing the caller a 0. Builds that ship Kineto -- every Linux ROCm wheel --
resolve to the profiler path exactly as before.
The Windows smoke suite added in #6273 measures no performance, so nothing
depends on this today. It matters as soon as any existing op test is pointed
at Windows, which is the next phase rather than this one.
Verified on MI308X, ROCm 7.2.4, torch 2.10.0, a 4096x4096 fp16 mm:
profiler path 785.4 us (unchanged)
cuda.Event path 799.9 us
forced fallback 798.1 us
The two timing methods agree to within 2%, so the fallback is not just
nonzero but comparable.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Motivation
Follow-up to #2699, from the Windows CI discussion there. Ops built with
ffi_type="ctypes"could not load on Windows, no committed test covered the Windows JIT path, and arocm[devel]pip install whose toolchain was not unpacked yet produced a misleading fallback warning. Running the wider op test set on Windows turned up two more Windows bugs, fixed here as well.Technical Details
The ctypes entry points are marked
__attribute__((visibility("default"))), which does not export anything from a PE DLL, so the module built and then failed withfunction 'rms_norm_opus' not found.AITER_C_ITFS, the twoOPUS_EXPORTmacros andgetPaddedMnow use__declspec(dllexport)on Windows. Linux is unchanged.op_tests/windows/test_jit_ops_smoke.pychecksrms_norm,rmsnorm2d_fwd,silu_and_mul,topk_softmaxandrotary_embedding_fwdagainst a torch reference, each in its own subprocess with a timeout, so a failed build, hang or GPU fault is reported against that op.Merged tuned config paths were joined with
:but split withos.pathsep, so on Windows any op with tuned files underconfigs/model_configs/tried to open one long path.hipbsolgemmincluded<sys/file.h>and linked with-lhipblaslt, but the ROCm SDK on Windows ships onlylibhipblaslt.dll.a; it now uses aLockFileEx-basedflockthere, and-l<name>falls back tolib<name>.dll.awhen no<name>.libexists.rocm[devel]from pip ships its toolchain as an archive that stays packed untilrocm-sdk initruns; the warning now points there instead of atHIP_PATH.requirements.txtgets the samesys_platform != 'win32'marker on flydsl thatpyproject.tomlalready has.Test Plan
Windows 11, RX 9060 XT (gfx1200), Python 3.12/3.13, torch 2.14.0+rocm10.1.0 and 2.16.0a0+rocm10.2.0 with the matching rocm[devel], no
HIP_PATH. The smoke test from a clean JIT cache, plustest_hipblaslt_lifecycle.py,test_batched_gemm_a8w8.pyand concurrent hipBLASLt online tuning writing one CSV.Test Result
All five smoke ops pass.
test_hipblaslt_lifecyclepasses; three concurrent tuning processes wrote 9 well-formed rows under one header.test_batched_gemm_a8w8now reaches the kernel, which is XDL-only and unsupported on RDNA.Submission Checklist