Skip to content

Commit f0b01dc

Browse files
committed
solve c10 sync
1 parent 1bd5ea9 commit f0b01dc

File tree

3 files changed

+64
-31
lines changed

3 files changed

+64
-31
lines changed

install_requirements.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,12 @@
1212

1313
from install_utils import determine_torch_url, is_intel_mac_os, python_is_compatible
1414

15-
from torch_pin import NIGHTLY_VERSION, TORCH_VERSION
15+
from torch_pin import NIGHTLY_VERSION, SUPPORTED_CUDA_VERSIONS, TORCH_VERSION
1616

1717
# The pip repository that hosts nightly torch packages.
1818
# This will be dynamically set based on CUDA availability and CUDA backend enabled/disabled.
1919
TORCH_NIGHTLY_URL_BASE = "https://download.pytorch.org/whl/nightly"
2020

21-
# Supported CUDA versions - modify this to add/remove supported versions
22-
# Format: tuple of (major, minor) version numbers
23-
SUPPORTED_CUDA_VERSIONS = (
24-
(12, 6),
25-
(12, 8),
26-
(13, 0),
27-
)
28-
29-
# Since ExecuTorch often uses main-branch features of pytorch, only the nightly
30-
# pip versions will have the required features.
31-
#
32-
# NOTE: If a newly-fetched version of the executorch repo changes the value of
33-
# NIGHTLY_VERSION, you should re-run this script to install the necessary
34-
# package versions.
35-
#
36-
# NOTE: If you're changing, make the corresponding change in .ci/docker/ci_commit_pins/pytorch.txt
37-
# by picking the hash from the same date in https://hud.pytorch.org/hud/pytorch/pytorch/nightly/
38-
#
39-
# NOTE: If you're changing, make the corresponding supported CUDA versions in
40-
# SUPPORTED_CUDA_VERSIONS above if needed.
41-
4221

4322
def install_requirements(use_pytorch_nightly):
4423
# Skip pip install on Intel macOS if using nightly.

runtime/core/portable_type/c10/torch/headeronly/macros/Macros.h

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -359,16 +359,15 @@ static inline int C10_WARP_SIZE_INTERNAL() {
359359
// Those platforms do not support assert()
360360
#define CUDA_KERNEL_ASSERT(cond)
361361
#define CUDA_KERNEL_ASSERT_MSG(cond, msg)
362+
#define CUDA_KERNEL_ASSERT_PRINTF(cond, msg, ...)
362363
#define SYCL_KERNEL_ASSERT(cond)
363364
#elif defined(_MSC_VER)
364365
#if defined(NDEBUG)
365366
extern "C" {
366367
C10_IMPORT
367368
#if defined(__SYCL_DEVICE_ONLY__)
368-
extern SYCL_EXTERNAL void _wassert(
369-
const wchar_t* wexpr,
370-
const wchar_t* wfile,
371-
unsigned line);
369+
extern SYCL_EXTERNAL void
370+
_wassert(const wchar_t* wexpr, const wchar_t* wfile, unsigned line);
372371
#else
373372
#if defined(__CUDA_ARCH__)
374373
__host__ __device__
@@ -396,6 +395,26 @@ __host__ __device__
396395
static_cast<unsigned>(__LINE__)), \
397396
0); \
398397
}
398+
#define CUDA_KERNEL_ASSERT_PRINTF(cond, msg, ...) \
399+
if (C10_UNLIKELY(!(cond))) { \
400+
(void)(printf( \
401+
"[CUDA_KERNEL_ASSERT] " __FILE__ ":" C10_STRINGIZE( \
402+
__LINE__) ": %s: block: [%d,%d,%d], thread: [%d,%d,%d]: " \
403+
"Assertion failed: `" #cond "`: " msg "\n", \
404+
__func__, \
405+
blockIdx.x, \
406+
blockIdx.y, \
407+
blockIdx.z, \
408+
threadIdx.x, \
409+
threadIdx.y, \
410+
threadIdx.z, \
411+
##__VA_ARGS__)); \
412+
(void)(_wassert( \
413+
_CRT_WIDE(#cond), \
414+
_CRT_WIDE(__FILE__), \
415+
static_cast<unsigned>(__LINE__)), \
416+
0); \
417+
}
399418
#define SYCL_KERNEL_ASSERT(cond) \
400419
if (C10_UNLIKELY(!(cond))) { \
401420
(void)(_wassert( \
@@ -415,11 +434,8 @@ extern SYCL_EXTERNAL void __assert_fail(
415434
const char* func);
416435
#elif (defined(__EMSCRIPTEN__))
417436
// As defined in assert.h in the Emscripten stdlib
418-
_Noreturn void __assert_fail(
419-
const char* expr,
420-
const char* file,
421-
int line,
422-
const char* func);
437+
_Noreturn void
438+
__assert_fail(const char* expr, const char* file, int line, const char* func);
423439
#else // __SYCL_DEVICE_ONLY__
424440
#if (defined(__CUDA_ARCH__) && !(defined(__clang__) && defined(__CUDA__)))
425441
// CUDA supports __assert_fail function which are common for both device
@@ -455,6 +471,10 @@ __host__ __device__
455471
if C10_UNLIKELY (!(cond)) { \
456472
abort(); \
457473
}
474+
#define CUDA_KERNEL_ASSERT_PRINTF(cond, msg, ...) \
475+
if C10_UNLIKELY (!(cond)) { \
476+
abort(); \
477+
}
458478
#define SYCL_KERNEL_ASSERT(cond) \
459479
if C10_UNLIKELY (!(cond)) { \
460480
abort(); \
@@ -470,6 +490,23 @@ __host__ __device__
470490
__assert_fail( \
471491
msg, __FILE__, static_cast<unsigned int>(__LINE__), __func__); \
472492
}
493+
#define CUDA_KERNEL_ASSERT_PRINTF(cond, msg, ...) \
494+
if (C10_UNLIKELY(!(cond))) { \
495+
printf( \
496+
"[CUDA_KERNEL_ASSERT] " __FILE__ ":" C10_STRINGIZE( \
497+
__LINE__) ": %s: block: [%d,%d,%d], thread: [%d,%d,%d]: " \
498+
"Assertion failed: `" #cond "`: " msg "\n", \
499+
__func__, \
500+
blockIdx.x, \
501+
blockIdx.y, \
502+
blockIdx.z, \
503+
threadIdx.x, \
504+
threadIdx.y, \
505+
threadIdx.z, \
506+
##__VA_ARGS__); \
507+
__assert_fail( \
508+
#cond, __FILE__, static_cast<unsigned int>(__LINE__), __func__); \
509+
}
473510
#define SYCL_KERNEL_ASSERT(cond) \
474511
if (C10_UNLIKELY(!(cond))) { \
475512
__assert_fail( \

torch_pin.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,19 @@
1+
# Since ExecuTorch often uses main-branch features of pytorch, only the nightly
2+
# pip versions will have the required features.
3+
#
4+
# NOTE: If a newly-fetched version of the executorch repo changes the value of
5+
# NIGHTLY_VERSION, you should re-run install_executorch.sh script to install the necessary
6+
# package versions.
7+
#
8+
# NOTE: If you're changing, make the corresponding change in .ci/docker/ci_commit_pins/pytorch.txt
9+
# by picking the hash from the same date in https://hud.pytorch.org/hud/pytorch/pytorch/nightly/
10+
#
11+
# NOTE: If you're changing, make the corresponding supported CUDA versions in
12+
# SUPPORTED_CUDA_VERSIONS above if needed.
113
TORCH_VERSION = "2.10.0"
214
NIGHTLY_VERSION = "dev20251003"
15+
SUPPORTED_CUDA_VERSIONS = (
16+
(12, 6),
17+
(12, 8),
18+
(13, 0),
19+
)

0 commit comments

Comments
 (0)