[Bug]: SM100 weight-only GEMM: no proxy fence between the transform warps' shared-memory reads and the TMA refill of the same stage
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 42/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- cpp
- Lĩnh vực
- backend, performance
Hướng nghiên cứu
Start with the transform loop in cpp/tensorrt_llm/cutlass_extensions/include/cutlass_extensions/gemm/collective/sm100_mma_warpspecialized_mixed_input.hpp, especially lines 974–981, and review the PTX proxy-fence requirements cited in the issue. Check generated SASS with cuobjdump to see whether transform-thread LDS results are first used after the stage-release arrive. Done means every transform thread's reads are ordered before the producer's TMA refill, with the stated B200 performance impact checked.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
System Info
- Source:
cpp/tensorrt_llm/cutlass_extensions/include/cutlass_extensions/gemm/collective/sm100_mma_warpspecialized_mixed_input.hppat main10e44bbf. - Binary: the 1.3.0rc26 wheel (
tensorrt_llm-1.3.0rc26-cp312-cp312-manylinux_2_28_x86_64.whl). The affected kernels are in the cubinslibth_common.2024–2027.sm_100.cubininsidetensorrt_llm/libs/libth_common.so, built by ptxas 13.2 (V13.2.78). - Measurements: B200, driver 595.58.03.
Who can help?
No response
Information
- The official example scripts
- My own modified scripts
Tasks
- An officially supported task in the
examplesfolder (such as GLUE/SQuAD, ...) - My own task or dataset (give details below)
Reproduction
We found this by reading the source and the SASS of the shipped wheel. We have not reproduced a wrong result on hardware (see "actual behavior").
The problem is in the transform loop of CollectiveMmaSm100WeightOnly (lines 974–981):
- The 128 transform threads read A and the scales/zeros of stage
swith ordinary shared-memory loads (lines 975 and 977). - They sync on
transform_bar(980). Then one elected thread releasesswithconsumer_release(981), which is an mbarrier arrive. - The producer refills
swith TMA for a later K tile.
The loads in step 1 go through the generic proxy, and TMA writes through the async proxy. There is no fence.proxy.async between them. The fence_view_async_shared() at line 996 comes after the release; it orders the writes of the dequantized A, not these reads.
The comment at line 979 says the loads are done. In SASS they are not: neither BAR.SYNC nor the arrive waits for outstanding LDS.
Below is the bf16 × int4 (scale only) kernel with a 64×128×64 tile, from libth_common.2027.sm_100.cubin, with unrelated instructions left out. The three loads are first used after the arrive:
/*05050*/ LDS.U16 R33, [R14+0x4908]
/*05080*/ LDS.U16 R32, [R30+0x31800]
/*050a0*/ LDS.U16 R30, [R30+0x31810]
/*050b0*/ BAR.SYNC.DEFER_BLOCKING 0x3, 0x80 // transform_bar.sync()
... 9 PRMT/SHF instructions, none of which reads R30, R32 or R33 ...
/*05150*/ @!P3 SYNCS.ARRIVE.TRANS64.RED.A1T0 RZ, [R31+URZ], RZ // consumer_release
The wheel has 22 instantiations of this collective, all with cluster 1×1×1. In 12 of them, loads of the stage are still in flight at the arrive:
| Activation × weight, tile | Loads in flight at the arrive |
|---|---|
| fp16 × int4/int8, 128×128 and 64×128 | 8 of 8 |
| bf16 × int4/int8, 64×128 | 2 of 3 (in one, only in the other warps) |
| fp8 × int4 with zero points, 128×128 | 2 of 2 |
| bf16 128×128 (3), fp8 128×128 without zero points (2), fp8 64×128 (4) | 0 of 9 |
To check a build:
- Run
cuobjdump -xelf all libth_common.so. - In each
CollectiveMmaSm100WeightOnlykernel, find theSYNCS.ARRIVEthat followsBAR.SYNC 0x3, 0x80. - See whether any earlier
LDSresult is first used after it.
Expected behavior
The TMA refill of a stage is ordered after every transform thread's reads of that stage.
PTX requires a proxy fence for this (PTX ISA 9.5, §8.6 "Proxies" and §9.7.10.28.2 "Async Proxy"). §9.7.10.28.2 states: "Accessing the same memory location across multiple proxies needs a cross-proxy fence." The mbarrier handoff alone does not provide that fence.
actual behavior
There is no fence. Under the PTX memory model, the refill may overwrite the stage before the reads complete. The transform would then dequantize data from a later K tile and report no error.
We have not seen this happen. On B200 we launched the wheel's own cubins through the driver API, filled D with NaN before each launch, and checked it against a float reference. Two of the kernels above (fp16 × int4 128×128 and bf16 × int4 64×128) ran 4.8×10¹¹ stage releases at M×N×K = 4096×5120×4096, with no wrong output. As a positive control, the same kernels with the loads moved after the release failed in 42% and 91% of launches.
Our explanation: these kernels fit only one CTA per SM (182–207 KB of shared memory). At that occupancy, 99.9% of refills took at least 261 ns after the release, which is longer than the loads take to finish.
A standalone litmus test with the same pattern (same-CTA arrive with loads in flight, no proxy fence, bulk-copy overwrite) does fail on B200 at 4 or more CTAs per SM: 239 stale reads in 7.9×10¹¹. With the fence it gives 0.
additional notes
Suggested fix: every transform thread calls fence_view_async_shared() before transform_bar.sync(). The barrier then orders all the fences before the single arrive. NVIDIA/cutlass#3974 uses the same placement for the SM120 blockwise-scaling mainloop.
Utils::copy_scale_zeros_for_transform(partitioned_extra_info, load2transform_consumer_index);
- // Loads from SMEM are done. Signal the mainloop load as early as possible
+ // Order this thread's reads of the stage before the producer's TMA refill
+ cutlass::arch::fence_view_async_shared();
transform_bar.sync();
load2transform_pipeline.consumer_release(curr_load2transform_pipeline_consumer_state);
Cost on B200 (bf16 × int4, group 64, 128×128×64 tile; GEMM time only):
| M×N×K | Change |
|---|---|
| 4096×5120×4096 | −0.2% |
| 16×5120×4096 | +0.9% |
| 128×16384×16384 | +0.4% |
Whether a given build has loads in flight here depends on ptxas scheduling, not on the source. The bf16 × int4 128×128 instantiation is closed in the wheel, which was built with ptxas 13.2. The same PTX compiled with ptxas 13.3–13.5 is open. The other two instantiations we rebuilt changed in other ways between 13.2 and 13.5: one stayed open, and the other's window narrowed. A toolchain update can therefore open this window without any source change.
Upstream CUTLASS has the same loop in include/cutlass/gemm/collective/sm100_mma_warpspecialized_mixed_input.hpp. We will report it there and link the issue below.
Before submitting a new issue...
- Make sure you already searched for relevant issues, and checked the documentation and examples for answers to frequently asked questions.
- Ngôn ngữ chính
- Python
- Star
- 15.2k
- Fork
- 3k
- Merge trung bình
- 2 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 477
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NVIDIA/TensorRT-LLM
-
Bug: AttributeError: 'GptOssConfig' object has no attribute 'rope_scaling_factor' with transformers >= 5.xCó thể đã có người làm @NimaVaziri đã nhận hôm nay. Đang mởPytorch
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NVIDIA/TensorRT-LLM#23406 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Inference runtime Windows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
NVIDIA/TensorRT-LLM#23394 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: MMLU subsampling changes when evaluators are interleavedCó thể đã có người làm @LeNeLeNeWo đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
NVIDIA/TensorRT-LLM#23273 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Trace-replay Pareto window includes the drain when sessions finish out of admission orderCó thể đã có người làm @sbeierle đã nhận 3 ngày trước. Đang mởTesting
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
NVIDIA/TensorRT-LLM#23077 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
LongBench V2 blog command breaks on inline comments after continuationsCó thể đã có người làm @ddlw đã nhận 25 ngày trước. Đang mởDoc
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
NVIDIA/TensorRT-LLM#21879 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của NVIDIA/TensorRT-LLM
Issue tương tự
-
[Resource]: SpaicelyĐang mởresource-submission validation-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
hesreallyhim/awesome-claude-code#3875 · 1 bình luận ·
-
[Bug]: Ajax Pro login issueĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
bvis/aegis-hass#725 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
datasektionen/cashflow#468 ·
-
dont call alembic upgrade until we check whether or not the cache DB has an alembic version stampĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
#1643 unrecoverable split: 1 digest with a 403 — two earlier captures of the same URL are real 200sĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Robin-IA/Congressional-Letters-Dev#1684 ·
Maintainer thường phản hồi trong vòng 1 ngày