Skip to content

Commit ae056a1

Browse files
committed
Add target device arch string in device properties
Signed-off-by: Ettore Tiotto <[email protected]>
1 parent 56f1fd0 commit ae056a1

File tree

3 files changed

+88
-1
lines changed

3 files changed

+88
-1
lines changed

python/triton/_internal_testing.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,83 @@ def is_xpu():
105105
target = get_current_target()
106106
return False if target is None else target.backend == "xpu"
107107

108+
def is_xpu_arl_h():
109+
target = get_current_target()
110+
return target is not None and target.backend == 'xpu' and 'arl_h' in target.arch
111+
112+
113+
def is_xpu_arl_s():
114+
target = get_current_target()
115+
return target is not None and target.backend == 'xpu' and 'arl_s' in target.arch
116+
117+
118+
def is_xpu_bmg():
119+
target = get_current_target()
120+
return target is not None and target.backend == 'xpu' and 'bmg' in target.arch
121+
122+
123+
def is_xpu_dg2():
124+
target = get_current_target()
125+
return target is not None and target.backend == 'xpu' and 'dg2' in target.arch
126+
127+
128+
def is_xpu_lnl():
129+
target = get_current_target()
130+
return target is not None and target.backend == 'xpu' and 'lnl' in target.arch
131+
132+
133+
def is_xpu_mtl():
134+
target = get_current_target()
135+
return target is not None and target.backend == 'xpu' and 'mtl' in target.arch
136+
137+
138+
def is_xpu_pvc():
139+
target = get_current_target()
140+
return target is not None and target.backend == 'xpu' and 'pvc' in target.arch
141+
142+
143+
def is_xpu_ptl_h():
144+
target = get_current_target()
145+
return target is not None and target.backend == 'xpu' and 'ptl_h' in target.arch
146+
147+
148+
def is_xpu_ptl_u():
149+
target = get_current_target()
150+
return target is not None and target.backend == 'xpu' and 'ptl_u' in target.arch
151+
152+
153+
def is_xpu_cri():
154+
target = get_current_target()
155+
return target is not None and target.backend == 'xpu' and 'cri' in target.arch
156+
157+
158+
def is_xpu_lpg():
159+
return is_xpu_arl_s()
160+
161+
162+
def is_xpu_lpgP():
163+
return is_xpu_arl_h()
164+
165+
166+
def is_xpu_hpg():
167+
return is_xpu_dg2()
168+
169+
170+
def is_xpu_hpc():
171+
return is_xpu_pvc()
172+
173+
174+
def is_xpu_xe2():
175+
return is_xpu_bmg()
176+
177+
178+
def is_xpu_xe3():
179+
return is_xpu_ptl_h() or is_xpu_ptl_u()
180+
181+
182+
def is_xpu_xe3P():
183+
return is_xpu_cri()
184+
108185

109186
def get_arch():
110187
target = get_current_target()

third_party/intel/backend/arch_parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ extern "C" EXPORT_FUNC const char *parse_device_arch(uint64_t dev_arch) {
5252
break;
5353
#endif
5454
case sycl::ext::oneapi::experimental::architecture::unknown:
55-
std::cerr << "unknown sycl_arch" << std::endl;
55+
std::cerr << "unknown" << std::endl;
5656
break;
5757
default:
5858
std::cerr << "sycl_arch not recognized: " << (uint64_t)sycl_arch

third_party/intel/backend/driver.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,17 @@ def update_advanced_features(device, dev_property):
942942
dev_property["has_subgroup_2d_block_io"] = check(device, b"cl_intel_subgroup_2d_block_io")
943943
dev_property["has_bfloat16_conversions"] = check(device, b"cl_intel_bfloat16_conversions")
944944

945+
def update_device_arch(dev_property):
946+
if not (arch := knobs.intel.device_arch):
947+
dirname = os.path.dirname(os.path.realpath(__file__))
948+
parser = compile_module_from_src(src=Path(os.path.join(dirname, "arch_parser.c")).read_text(),
949+
name="arch_utils")
950+
arch_name = parser.parse_device_arch(dev_property["architecture"])
951+
dev_property["arch"] = arch
952+
945953
update_advanced_features(device, dev_property)
954+
update_device_arch(dev_property)
955+
946956
return GPUTarget("xpu", dev_property, warp_size=32)
947957

948958
def build_proton_help_lib(self):

0 commit comments

Comments
 (0)