From 4c5f9348f4c48cee2486d5b35813cc3e055a9c3a Mon Sep 17 00:00:00 2001 From: "Michael C. McMinn" Date: Wed, 5 Nov 2025 01:42:52 -0500 Subject: [PATCH 1/2] Adding gfx908 support, needs testing --- CMakeLists.txt | 2 +- include/aotriton/util.h | 1 + v2python/gpu_targets.py | 2 ++ v2python/tuning_lut.py | 1 + v2src/util.cc | 1 + v3python/compile.py | 2 +- v3python/gpu_targets.py | 4 ++++ v3src/util.cc | 1 + 8 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c31b12cd..9f7b2296 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,7 +80,7 @@ option(AOTRITON_INHERIT_SYSTEM_SITE_TRITON "Use system site packages and verify set(AOTRITON_USE_LOCAL_TRITON_WHEEL "" CACHE STRING "Substitute install from third_party/triton with install from local pip wheel package.") set(AOTRITON_GPU_BUILD_TIMEOUT "8.0" CACHE STRING "GPU kernel compiler times out after X minutes. 0 for indefinite. Highly recommended if AOTRITON_BUILD_FOR_TUNING=On.") option(AOTRITON_TERMINATE_WHEN_GPU_BUILD_TIMEOUT "compile.py will return error when GPU built timeout. Defensive option for CI" OFF) -set(AOTRITON_TARGET_ARCH "gfx90a;gfx942;gfx950;gfx1100;gfx1101;gfx1102;gfx1151;gfx1150;gfx1201;gfx1200" CACHE STRING "Target GPU Architecture. Select all GPUs within the given list") +set(AOTRITON_TARGET_ARCH "gfx908;gfx90a;gfx942;gfx950;gfx1100;gfx1101;gfx1102;gfx1151;gfx1150;gfx1201;gfx1200" CACHE STRING "Target GPU Architecture. Select all GPUs within the given list") set(TARGET_GPUS "OBSOLETE" CACHE STRING "OBSOLETE. To select only one GPU, use AOTRITON_TARGET_ARCH or AOTRITON_OVERRIDE_TARGET_GPUS.") set(AOTRITON_OVERRIDE_TARGET_GPUS "" CACHE STRING "Override AOTRITON_TARGET_ARCH, and only build for GPUs within this list.") set(AOTRITON_ALT_TRITON_WHEEL_CONFIG_FILE "" CACHE STRING "Specify how to use alternative Triton wheels for different architectures in a YAML config file.") diff --git a/include/aotriton/util.h b/include/aotriton/util.h index 4ed494fe..a677b253 100644 --- a/include/aotriton/util.h +++ b/include/aotriton/util.h @@ -52,6 +52,7 @@ enum AOTRITON_API GpuVendor : uint16_t { // More bits for potential non-PCI architectures enum AOTRITON_API Gpu : uint64_t { GPU_ARCH_UNKNOWN = 0, + GPU_AMD_ARCH_GFX908_MOD0 = TRICAT(GpuVendor::kAMD, 0x908, 0), GPU_AMD_ARCH_GFX90A_MOD0 = TRICAT(GpuVendor::kAMD, 0x90a, 0), GPU_AMD_ARCH_GFX942_MOD0 = TRICAT(GpuVendor::kAMD, 0x942, 0), GPU_AMD_ARCH_GFX942_MOD1 = TRICAT(GpuVendor::kAMD, 0x942, 1), diff --git a/v2python/gpu_targets.py b/v2python/gpu_targets.py index 622def31..131b9ede 100644 --- a/v2python/gpu_targets.py +++ b/v2python/gpu_targets.py @@ -4,6 +4,7 @@ from collections import defaultdict AOTRITON_SUPPORTED_GPUS = ( + 'gfx908_mod0', 'gfx90a_mod0', 'gfx942_mod0', # 'gfx942_mod1', @@ -21,6 +22,7 @@ } AOTRITON_ARCH_WARPSIZE = { + 'gfx908' : 64, 'gfx90a' : 64, 'gfx942' : 64, 'gfx950' : 64, diff --git a/v2python/tuning_lut.py b/v2python/tuning_lut.py index 723b7444..2640205e 100644 --- a/v2python/tuning_lut.py +++ b/v2python/tuning_lut.py @@ -13,6 +13,7 @@ SKIPPED_LUT_CHECK = os.getenv('AOTRITON_SKIP_LUT_CHECK', default='').split(',') ARCH_TO_DIRECTORY = { + 'gfx908' : 'amd-gfx908', 'gfx90a' : 'amd-gfx90a', 'gfx942' : 'amd-gfx942', 'gfx1100' : 'amd-gfx110x', diff --git a/v2src/util.cc b/v2src/util.cc index a66488ea..8bfacb8a 100644 --- a/v2src/util.cc +++ b/v2src/util.cc @@ -46,6 +46,7 @@ struct LazyGpu { }; std::unordered_map LazyGpu::string_to_classifier = { + { "gfx908", DummyClassifier() }, { "gfx90a", DummyClassifier() }, { "gfx942", DummyClassifier() }, {"gfx1100", DummyClassifier() }, diff --git a/v3python/compile.py b/v3python/compile.py index f72ddf24..859401e3 100644 --- a/v3python/compile.py +++ b/v3python/compile.py @@ -14,7 +14,7 @@ from triton.backends.compiler import GPUTarget -KNOWN_TARGETS_64 = ['gfx90a', 'gfx942', 'gfx950'] +KNOWN_TARGETS_64 = ['gfx908', 'gfx90a', 'gfx942', 'gfx950'] KNOWN_TARGETS_32 = ['gfx1100', 'gfx1101', 'gfx1102', 'gfx1201', 'gfx1200', 'gfx1151', 'gfx1150', 'gfx1250'] KNOWN_TARGETS = { diff --git a/v3python/gpu_targets.py b/v3python/gpu_targets.py index 84927579..70ddf575 100644 --- a/v3python/gpu_targets.py +++ b/v3python/gpu_targets.py @@ -4,6 +4,7 @@ from collections import defaultdict AOTRITON_SUPPORTED_GPUS = ( + 'gfx908_mod0', 'gfx90a_mod0', 'gfx942_mod0', # 'gfx942_mod1', @@ -31,6 +32,7 @@ } AOTRITON_ARCH_TO_PACK = { + 'gfx908' : 'gfx908', 'gfx90a' : 'gfx90a', 'gfx942' : 'gfx942', 'gfx950' : 'gfx950', @@ -49,6 +51,7 @@ } AOTRITON_ARCH_WARPSIZE = { + 'gfx908' : 64, 'gfx90a' : 64, 'gfx942' : 64, 'gfx950' : 64, @@ -63,6 +66,7 @@ } AOTRITON_ARCH_PRODUCTION_LINE = { + 'gfx908' : 'CDNA', 'gfx90a' : 'CDNA', 'gfx942' : 'CDNA', 'gfx950' : 'CDNA', diff --git a/v3src/util.cc b/v3src/util.cc index f70804ec..307f4785 100644 --- a/v3src/util.cc +++ b/v3src/util.cc @@ -46,6 +46,7 @@ struct LazyGpu { }; std::unordered_map LazyGpu::string_to_classifier = { + { "gfx908", DummyClassifier() }, { "gfx90a", DummyClassifier() }, { "gfx942", DummyClassifier() }, {"gfx1100", DummyClassifier() }, From e087808b21a9962194061b404ab417ec2b04bf51 Mon Sep 17 00:00:00 2001 From: "Michael C. McMinn" Date: Tue, 18 Nov 2025 01:47:00 -0500 Subject: [PATCH 2/2] Adding 908 to isArchExperimentallySupported, removed changes from v2. Added textual to the requirements for tuning since the tuning script needs this module --- requirements-tuning.txt | 1 + v2python/tuning_lut.py | 1 - v2src/util.cc | 1 - v3src/util.cc | 3 ++- 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements-tuning.txt b/requirements-tuning.txt index 75fb1838..aa8bc950 100644 --- a/requirements-tuning.txt +++ b/requirements-tuning.txt @@ -5,3 +5,4 @@ filelock celery[pyamqp,sqlalchemy] psycopg # the more mature psycopg2 needs extra binaries. dacite +textual \ No newline at end of file diff --git a/v2python/tuning_lut.py b/v2python/tuning_lut.py index 2640205e..723b7444 100644 --- a/v2python/tuning_lut.py +++ b/v2python/tuning_lut.py @@ -13,7 +13,6 @@ SKIPPED_LUT_CHECK = os.getenv('AOTRITON_SKIP_LUT_CHECK', default='').split(',') ARCH_TO_DIRECTORY = { - 'gfx908' : 'amd-gfx908', 'gfx90a' : 'amd-gfx90a', 'gfx942' : 'amd-gfx942', 'gfx1100' : 'amd-gfx110x', diff --git a/v2src/util.cc b/v2src/util.cc index 8bfacb8a..a66488ea 100644 --- a/v2src/util.cc +++ b/v2src/util.cc @@ -46,7 +46,6 @@ struct LazyGpu { }; std::unordered_map LazyGpu::string_to_classifier = { - { "gfx908", DummyClassifier() }, { "gfx90a", DummyClassifier() }, { "gfx942", DummyClassifier() }, {"gfx1100", DummyClassifier() }, diff --git a/v3src/util.cc b/v3src/util.cc index 307f4785..1063f518 100644 --- a/v3src/util.cc +++ b/v3src/util.cc @@ -74,7 +74,8 @@ getGpuFromStream(hipStream_t stream) { bool isArchExperimentallySupported(hipStream_t stream) { auto gpu = getGpuFromStream(stream); uint32_t vendor_arch = Gpu2VendorArch(gpu); - return (vendor_arch == CAT32(GpuVendor::kAMD, 0x1150) || + return (vendor_arch == CAT32(GpuVendor::kAMD, 0x908) || + vendor_arch == CAT32(GpuVendor::kAMD, 0x1150) || vendor_arch == CAT32(GpuVendor::kAMD, 0x1151) || vendor_arch == CAT32(GpuVendor::kAMD, 0x1100) || vendor_arch == CAT32(GpuVendor::kAMD, 0x1101) ||