-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_gdn_packed_decode_triton.cpp
More file actions
36 lines (33 loc) · 1.82 KB
/
Copy pathtest_gdn_packed_decode_triton.cpp
File metadata and controls
36 lines (33 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// vllm.cpp original (vt runtime env-flag plumbing; the kernel it selects is the
// VENDORED vLLM FLA packed-decode cubin, see src/vt/cuda/cuda_gdn.cu).
// CPU-tier contract for the env-flag plumbing that selects the vendored Triton
// AOT packed-decode fast-path (src/vt/cuda/gdn_packed_decode_triton.h): the
// VT_GDN_PACKED_DECODE_TRITON flag predicate. The cubin itself is CUDA-only and
// lives in cuda_gdn.cu (TryTritonPackedDecode -> gdn_decode_h{48,32}); its
// bit-exactness and the default-fires / "=0"-rollback launch check are DGX-gated
// CUDA cases in tests/vt/test_ops_gdn.cpp. This suite pins the portable
// default-ON / '0'-off parse so the rollback contract is regression-covered on
// every platform, not just DGX.
#include <doctest/doctest.h>
#include "vt/cuda/gdn_packed_decode_triton.h"
using vt::cuda::GdnPackedDecodeTritonFlagIsOn;
TEST_CASE(
"VT_GDN_PACKED_DECODE_TRITON defaults ON; only a '0'-leading value rolls "
"back") {
// Default (unset) is ON: the vendored FLA cubin IS vLLM's exact kernel and is
// token-identical, so it ships as the default like the sibling GDN Triton
// kernels (VT_GDN_DELTAH_TRITON / VT_GDN_CHUNKO_TRITON / VT_GDN_WU_TRITON).
CHECK(GdnPackedDecodeTritonFlagIsOn(nullptr));
// Non-'0'-leading values stay ON (the default).
CHECK(GdnPackedDecodeTritonFlagIsOn(""));
CHECK(GdnPackedDecodeTritonFlagIsOn("on"));
CHECK(GdnPackedDecodeTritonFlagIsOn("true"));
CHECK(GdnPackedDecodeTritonFlagIsOn("1"));
CHECK(GdnPackedDecodeTritonFlagIsOn("2"));
CHECK(GdnPackedDecodeTritonFlagIsOn(" 0")); // leading space, not '0'
// Rollback: FIRST character '0' restores the hand GdnPackedDecodeKernel in the
// SAME binary.
CHECK_FALSE(GdnPackedDecodeTritonFlagIsOn("0"));
CHECK_FALSE(GdnPackedDecodeTritonFlagIsOn("0abc"));
CHECK_FALSE(GdnPackedDecodeTritonFlagIsOn("00"));
}