dylanyunlon
|
ddfd24da27
|
fix: sync to real-machine verified version — ALL TESTS PASSED
真机验证通过的精确版本:
- CUB_NS_QUALIFIER (不是 cub::)
- thread_local inside_cub reentrant guard
- 去掉 -D_CCCL_COMPILER_GCC=1
- total_mem → total_memory
BI-V100 32GB × Iluvatar, CoreX clang++ 编译 51864 bytes .so
expandable_segments:True 被 strip, CUB allocator 接管, 缓存复用确认
|
2026-08-13 09:52:15 +00:00 |
|
dylanyunlon
|
93e498197a
|
fix: thread_local reentrant guard — prevent cudaMalloc infinite recursion
CUB CachingDeviceAllocator 内部在 cache miss 时调 cudaMalloc,
被我们的 LD_PRELOAD 再次拦截 → DeviceAllocate → cudaMalloc → 无限递归 → segfault。
加 thread_local bool inside_cub 标志:
外部调用 → CUB allocator (带缓存)
CUB 内部调用 → 直接走 dlsym(RTLD_NEXT) 的真实 cudaMalloc
|
2026-08-13 09:42:26 +00:00 |
|
dylanyunlon
|
0ac118911d
|
fix: CUB_NS_QUALIFIER for wrapped namespace + drop _CCCL_COMPILER_GCC
CoreX clang++ 不是 GCC,-D_CCCL_COMPILER_GCC=1 和 CCCL 自己的
compiler detection 冲突。
CUB_WRAPPED_NAMESPACE=cccl_preload 使得命名空间变成 cccl_preload::cub,
用 CUB_NS_QUALIFIER 宏自动解析正确的命名空间。
|
2026-08-13 09:31:45 +00:00 |
|
dylanyunlon
|
8d6f9eaeb0
|
feat: CCCL CachingDeviceAllocator preload — 完整依赖链 288 files
从 cccl_upstream 递归追踪 cub/util_allocator.cuh 的全部 include 依赖:
cub/ 9 files (config, util_*, version, detect_cuda_runtime)
cuda/ libcudacxx type_traits, concepts, algorithm, iterator...
nv/ target macros, preprocessor
总计 288 个头文件 (1.4MB),打包到 include/ 目录,编译时 -I include
即可完全脱离 CCCL 原始目录结构。
.cu 文件直接 #include <cub/util_allocator.cuh>,
走原版 CUB CachingDeviceAllocator,零 mock。
BI-V100 参数: growth=2 bins=[8..32] max_cached=8GB/device
|
2026-08-13 09:26:41 +00:00 |
|
dylanyunlon
|
967d572073
|
feat: CCCL CachingDeviceAllocator LD_PRELOAD — bypass CoreX expandable_segments ASSERT
从 CCCL upstream cub/cub/util_allocator.cuh 提取 CachingDeviceAllocator
核心算法,去掉所有 CUB/CCCL 宏依赖,编译为独立 .so。
用 LD_PRELOAD 拦截 cudaMalloc/cudaFree,路由到 CUB 的 geometric-bin
缓存分配器。同时在 constructor 中 strip PYTORCH_CUDA_ALLOC_CONF 里的
expandable_segments 配置,避免 CoreX CUDACachingAllocator.cpp:545 ASSERT。
BI-V100 调优参数:
bin_growth=8, min_bin=3 (512B), max_bin=13 (~550MB)
max_cached_bytes=4GB per device (32GB卡的合理上限)
真机测试步骤:
1. bash build_cccl_preload.sh
2. LD_PRELOAD=./libcccl_allocator.so CCCL_ALLOC_DEBUG=1 \
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
python3 verify_preload.py
|
2026-08-13 09:26:41 +00:00 |
|