diff options
Diffstat (limited to 'libsmctrl.c')
| -rw-r--r-- | libsmctrl.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/libsmctrl.c b/libsmctrl.c index 817cb5d..b10b885 100644 --- a/libsmctrl.c +++ b/libsmctrl.c | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | * +-----------+---------------+---------------+--------------+ | 11 | * +-----------+---------------+---------------+--------------+ |
| 12 | * | Version | Global Mask | Stream Mask | Next Mask | | 12 | * | Version | Global Mask | Stream Mask | Next Mask | |
| 13 | * +-----------+---------------+---------------+--------------+ | 13 | * +-----------+---------------+---------------+--------------+ |
| 14 | * | 11.0-12.2 | TMD/QMD Hook | stream struct | TMD/QMD Hook | | 14 | * | 11.0-12.6 | TMD/QMD Hook | stream struct | TMD/QMD Hook | |
| 15 | * | 10.2 | global struct | stream struct | N/A | | 15 | * | 10.2 | global struct | stream struct | N/A | |
| 16 | * | 8.0-10.1 | N/A | stream struct | N/A | | 16 | * | 8.0-10.1 | N/A | stream struct | N/A | |
| 17 | * +-----------+---------------+---------------+--------------+ | 17 | * +-----------+---------------+---------------+--------------+ |
| @@ -269,12 +269,19 @@ void libsmctrl_set_next_mask(uint64_t mask) { | |||
| 269 | // 12.0 tested on 525.147.05 | 269 | // 12.0 tested on 525.147.05 |
| 270 | #define CU_12_2_MASK_OFF 0x4e4 | 270 | #define CU_12_2_MASK_OFF 0x4e4 |
| 271 | // 12.2 tested on 535.129.03 | 271 | // 12.2 tested on 535.129.03 |
| 272 | // CUDA 12.3 UNTESTED | ||
| 273 | #define CU_12_4_MASK_OFF 0x4ac | ||
| 274 | // 12.4 tested on 550.54.14 and 550.54.15 | ||
| 275 | // CUDA 12.5 UNTESTED | ||
| 276 | #define CU_12_6_MASK_OFF 0x4ec | ||
| 277 | // 12.6 tested on 560.35.03 | ||
| 272 | 278 | ||
| 273 | // Offsets for the stream struct on aarch64 | 279 | // Offsets for the stream struct on aarch64 |
| 274 | // All tested on Nov 13th, 2023 | 280 | // All tested on Nov 13th, 2023 |
| 275 | #define CU_9_0_MASK_OFF_JETSON 0x128 // Tested on TX2 | 281 | #define CU_9_0_MASK_OFF_JETSON 0x128 // Tested on TX2 |
| 276 | #define CU_10_2_MASK_OFF_JETSON 0x24c // Tested on TX2 and Jetson Xavier | 282 | #define CU_10_2_MASK_OFF_JETSON 0x24c // Tested on TX2 and Jetson Xavier |
| 277 | #define CU_11_4_MASK_OFF_JETSON 0x394 // Tested on Jetson Orin | 283 | #define CU_11_4_MASK_OFF_JETSON 0x394 // Tested on Jetson Orin |
| 284 | #define CU_12_6_MASK_OFF_JETSON 0x514 // Tested on Jetson Orin | ||
| 278 | 285 | ||
| 279 | // Used up through CUDA 11.8 in the stream struct | 286 | // Used up through CUDA 11.8 in the stream struct |
| 280 | struct stream_sm_mask { | 287 | struct stream_sm_mask { |
| @@ -316,10 +323,11 @@ int detect_parker_soc() { | |||
| 316 | } | 323 | } |
| 317 | #endif // __aarch64__ | 324 | #endif // __aarch64__ |
| 318 | 325 | ||
| 319 | // Should work for CUDA 8.0 through 12.2 | 326 | // Should work for CUDA 8.0 through 12.2, plus 12.4 and 12.6 |
| 320 | // A cudaStream_t is a CUstream*. We use void* to avoid a cuda.h dependency in | 327 | // A cudaStream_t is a CUstream*. We use void* to avoid a cuda.h dependency in |
| 321 | // our header | 328 | // our header |
| 322 | void libsmctrl_set_stream_mask(void* stream, uint64_t mask) { | 329 | void libsmctrl_set_stream_mask(void* stream, uint64_t mask) { |
| 330 | // When the old API is used on GPUs with over 64 TPCs, disable all TPCs >64 | ||
| 323 | uint128_t full_mask = -1; | 331 | uint128_t full_mask = -1; |
| 324 | full_mask <<= 64; | 332 | full_mask <<= 64; |
| 325 | full_mask |= mask; | 333 | full_mask |= mask; |
| @@ -377,6 +385,12 @@ void libsmctrl_set_stream_mask_ext(void* stream, uint128_t mask) { | |||
| 377 | case 12020: | 385 | case 12020: |
| 378 | hw_mask_v2 = (void*)(stream_struct_base + CU_12_2_MASK_OFF); | 386 | hw_mask_v2 = (void*)(stream_struct_base + CU_12_2_MASK_OFF); |
| 379 | break; | 387 | break; |
| 388 | case 12040: | ||
| 389 | hw_mask_v2 = (void*)(stream_struct_base + CU_12_4_MASK_OFF); | ||
| 390 | break; | ||
| 391 | case 12060: | ||
| 392 | hw_mask_v2 = (void*)(stream_struct_base + CU_12_6_MASK_OFF); | ||
| 393 | break; | ||
| 380 | #elif __aarch64__ | 394 | #elif __aarch64__ |
| 381 | case 9000: { | 395 | case 9000: { |
| 382 | // Jetson TX2 offset is slightly different on CUDA 9.0. | 396 | // Jetson TX2 offset is slightly different on CUDA 9.0. |
| @@ -402,6 +416,9 @@ void libsmctrl_set_stream_mask_ext(void* stream, uint128_t mask) { | |||
| 402 | case 11040: | 416 | case 11040: |
| 403 | hw_mask = (struct stream_sm_mask*)(stream_struct_base + CU_11_4_MASK_OFF_JETSON); | 417 | hw_mask = (struct stream_sm_mask*)(stream_struct_base + CU_11_4_MASK_OFF_JETSON); |
| 404 | break; | 418 | break; |
| 419 | case 12060: | ||
| 420 | hw_mask = (struct stream_sm_mask*)(stream_struct_base + CU_12_6_MASK_OFF_JETSON); | ||
| 421 | break; | ||
| 405 | #endif | 422 | #endif |
| 406 | } | 423 | } |
| 407 | 424 | ||
