Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[testing] Enable generating cached native code by default #2350

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions python/test/unit/language/test_line_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,17 @@ def test_line_info(func: str):
shape = (128, )
kernel_info = {}
if func == "single":
kernel_info = kernel_single.warmup(torch.float32, torch.float32, BLOCK=shape[0], grid=(1,))
kernel_info = kernel_single.warmup(torch.float32, torch.float32, BLOCK=shape[0], grid=(1,), generate_native_code=False)
elif func == "call":
kernel_info = kernel_call.warmup(torch.float32, torch.float32, BLOCK=shape[0], grid=(1,))
kernel_info = kernel_call.warmup(torch.float32, torch.float32, BLOCK=shape[0], grid=(1,), generate_native_code=False)
elif func == "call_noinline":
kernel_info = kernel_call_noinline.warmup(torch.float32, torch.float32, BLOCK=shape[0], grid=(1,))
kernel_info = kernel_call_noinline.warmup(torch.float32, torch.float32, BLOCK=shape[0], grid=(1,), generate_native_code=False)
elif func == "autotune":
kernel_info = kernel_autotune.warmup(torch.float32, torch.float32, SIZE=shape[0], grid=(1,))[0]
kernel_info = kernel_autotune.warmup(torch.float32, torch.float32, SIZE=shape[0], grid=(1,), generate_native_code=False)[0]
elif func == "dot_combine":
kernel_info = kernel_dot_combine.warmup(20, grid=(1,))
kernel_info = kernel_dot_combine.warmup(20, grid=(1,), generate_native_code=False)
elif func == "cdiv":
kernel_info = kernel_cdiv.warmup(20, grid=(1,))
kernel_info = kernel_cdiv.warmup(20, grid=(1,), generate_native_code=False)

if obj_kind == "spvbin":
file_lines = spv_extract_file_lines(kernel_info.asm["spv"], command)
Expand Down
8 changes: 6 additions & 2 deletions third_party/intel/backend/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class XPUOptions:
max_num_imprecise_acc_default: int = 0 # `max_num_imprecise_acc` only applies to fp8 -> fp32 dot on sm_90 for cuda
extern_libs: dict = None
debug: bool = False
generate_native_code: bool = False
generate_native_code: bool = True
backend_name: str = 'intel'

def __post_init__(self):
Expand All @@ -65,7 +65,11 @@ def __post_init__(self):
object.__setattr__(self, 'extern_libs', tuple(extern_libs.items()))
if self.num_warps <= 0 or (self.num_warps & (self.num_warps - 1)) != 0:
raise AssertionError("num_warps must be a power of 2")
self.generate_native_code = bool(os.getenv("TRITON_XPU_GEN_NATIVE_CODE", self.generate_native_code))
generate_native_code_env = os.getenv("TRITON_XPU_GEN_NATIVE_CODE")
if generate_native_code_env:
self.generate_native_code = bool(generate_native_code_env)
else:
os.putenv("TRITON_XPU_GEN_NATIVE_CODE", str(self.generate_native_code))

def hash(self):
key = '_'.join([f'{name}-{val}' for name, val in self.__dict__.items()])
Expand Down