okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-142c-small into f-142407ea8192

main
2.8 KiB49 linesraw
1--- pristine-0.1.40.4/include/strata/hip_compat/cuda_runtime.h	2026-10-08 13:23:15.000000000 +0800
2+++ /home/user/Strata/.bench/0.1.40.4/include/strata/hip_compat/cuda_runtime.h	2026-10-09 21:09:25.988281321 +0800
3@@ -144,3 +144,46 @@
4 #define cudaMemcpyToSymbol(symbol, ...) hipMemcpyToSymbol(HIP_SYMBOL(symbol), __VA_ARGS__)
5 
6 #include "intrinsics.hpp"
7+
8+// --- 本地补丁(社区基准报告):ROCm 6.2 / gfx906 -------------------------------------------
9+// 0.1.40.x 把兼容头搬到了 include/strata/hip_compat/,但相比 0.1.39 的
10+// include/strata/platform/hip_compat/strata_hip.h 少了下面 24 个映射,gfx906 构建会报
11+// "use of undeclared identifier" / "unknown type name"。映射逐条取自那个(已在 gfx906 上
12+// 验证可用的)旧头。
13+#define cudaDevAttrGlobalMemoryBusWidth hipDeviceAttributeMemoryBusWidth
14+#define cudaDevAttrMemoryClockRate hipDeviceAttributeMemoryClockRate
15+#define cudaDeviceMapHost hipDeviceMapHost
16+#define cudaDeviceScheduleBlockingSync hipDeviceScheduleBlockingSync
17+#define cudaDeviceScheduleSpin hipDeviceScheduleSpin
18+#define cudaDeviceScheduleYield hipDeviceScheduleYield
19+#define cudaEventDefault hipEventDefault
20+#define cudaGetErrorName hipGetErrorName
21+#define cudaGraphKernelNodeGetParams hipGraphKernelNodeGetParams
22+#define cudaGraphNodeGetType hipGraphNodeGetType
23+#define cudaGraphNodeType hipGraphNodeType
24+#define cudaGraphNodeTypeKernel hipGraphNodeTypeKernel
25+#define cudaGraphNodeTypeMemcpy hipGraphNodeTypeMemcpy
26+#define cudaGraphNodeTypeMemset hipGraphNodeTypeMemset
27+#define cudaGraphNode_t hipGraphNode_t
28+#define cudaHostAllocWriteCombined hipHostMallocWriteCombined
29+#define cudaHostRegisterDefault hipHostRegisterDefault
30+#define cudaKernelNodeParams hipKernelNodeParams
31+#define cudaMemcpyKind hipMemcpyKind
32+#define cudaSetDeviceFlags hipSetDeviceFlags
33+#define cudaSharedmemCarveoutMaxShared 100
34+#define cudaStreamCaptureModeGlobal hipStreamCaptureModeGlobal
35+#define cudaStreamCaptureModeRelaxed hipStreamCaptureModeRelaxed
36+#define cudaStreamCaptureStatusActive hipStreamCaptureStatusActive
37+
38+// 本地补丁(社区基准报告):CUDA 12 的 cudaInitDevice(dev, deviceFlags, flags) —— 初始化设备及其调度
39+// 标志,但**不改变当前设备**(分层多卡依赖这个语义)。实现逐字取自 0.1.39 的
40+// include/strata/platform/hip_compat/strata_hip.h(已在 gfx906 上验证可用)。
41+inline hipError_t cudaInitDevice(int device, unsigned int device_flags, unsigned int /*flags*/) {
42+    int prev = 0;
43+    hipError_t e = hipGetDevice(&prev);
44+    if (e != hipSuccess) return e;
45+    e = hipSetDevice(device);
46+    if (e != hipSuccess) return e;
47+    if (hipSetDeviceFlags(device_flags) != hipSuccess) (void) hipGetLastError();   // context already active
48+    return hipSetDevice(prev);
49+}