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

[NFCI][SYCL] Pass SPIR-V extensions explicitly to jit compiler #17359

Open
wants to merge 1 commit into
base: sycl
Choose a base branch
from

Conversation

MrSidims
Copy link
Contributor

@MrSidims MrSidims commented Mar 7, 2025

Resolves #16597

@MrSidims MrSidims marked this pull request as ready for review March 7, 2025 16:16
@MrSidims MrSidims requested a review from a team as a code owner March 7, 2025 16:16
// Keep this in sync with clang/lib/Driver/ToolChains/Clang.cpp
// TODO: consider introducing a config file that both clang and jit-compiler
// could use during options setting.
std::vector<SPIRV::ExtensionID> AllowedExtensions {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep the same order as in Clang.cpp?

I'm trying to check that the lists match, but I find it quite challenging with the order changed.

Copy link
Contributor Author

@MrSidims MrSidims Mar 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make my life easier I have copied all of the extension we have in https://github.com/KhronosGroup/SPIRV-LLVM-Translator/blob/main/include/LLVMSPIRVExtensions.inc and removed unused in Clang.cpp extensions. I have also not included AOT FPGA extensions and some other extensions, like SPV_INTEL_debug_module - which are being deprecated. Like this order is not preserved. Do you really what it to have the same order?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will have to constantly keep this in sync with Clang.cpp, which is hard to see if the order very different. For example, SPV_EXT_shader_atomic_float16_add appears last-but-one in Clang.cpp, but first here.

Would it help you to just copy the list from Clang.cpp and apply a bit of search-and-replace to get the right format?

Then, the maintenance task of keeping them in sync becomes easier, because they'll have the same order (ignoring FPGA).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SPIRV::ExtensionID::SPV_EXT_shader_atomic_float_add, SPIRV::ExtensionID::SPV_EXT_shader_atomic_float_min_max,
SPIRV::ExtensionID::SPV_KHR_no_integer_wrap_decoration, SPIRV::ExtensionID::SPV_KHR_float_controls,
SPIRV::ExtensionID::SPV_KHR_expect_assume, SPIRV::ExtensionID::SPV_KHR_linkonce_odr,
SPIRV::ExtensionID::SPV_INTEL_subgroups, SPIRV::ExtensionID::SPV_INTEL_media_block_io,
SPIRV::ExtensionID::SPV_INTEL_device_side_avc_motion_estimation,
SPIRV::ExtensionID::SPV_INTEL_fpga_loop_controls, SPIRV::ExtensionID::SPV_INTEL_unstructured_loop_controls,
SPIRV::ExtensionID::SPV_INTEL_fpga_reg, SPIRV::ExtensionID::SPV_INTEL_blocking_pipes,
SPIRV::ExtensionID::SPV_INTEL_function_pointers, SPIRV::ExtensionID::SPV_INTEL_kernel_attributes,
SPIRV::ExtensionID::SPV_INTEL_io_pipes, SPIRV::ExtensionID::SPV_INTEL_inline_assembly,
SPIRV::ExtensionID::SPV_INTEL_arbitrary_precision_integers,
SPIRV::ExtensionID::SPV_INTEL_float_controls2, SPIRV::ExtensionID::SPV_INTEL_vector_compute,
SPIRV::ExtensionID::SPV_INTEL_fast_composite,
SPIRV::ExtensionID::SPV_INTEL_arbitrary_precision_fixed_point,
SPIRV::ExtensionID::SPV_INTEL_arbitrary_precision_floating_point,
SPIRV::ExtensionID::SPV_INTEL_variable_length_array, SPIRV::ExtensionID::SPV_INTEL_fp_fast_math_mode,
SPIRV::ExtensionID::SPV_INTEL_long_composites,
SPIRV::ExtensionID::SPV_INTEL_arithmetic_fence,
SPIRV::ExtensionID::SPV_INTEL_global_variable_decorations,
SPIRV::ExtensionID::SPV_INTEL_cache_controls,
SPIRV::ExtensionID::SPV_INTEL_fpga_buffer_location,
SPIRV::ExtensionID::SPV_INTEL_fpga_argument_interfaces,
SPIRV::ExtensionID::SPV_INTEL_fpga_invocation_pipelining_attributes,
SPIRV::ExtensionID::SPV_INTEL_fpga_latency_control,
SPIRV::ExtensionID::SPV_KHR_shader_clock,
SPIRV::ExtensionID::SPV_INTEL_bindless_images,
SPIRV::ExtensionID::SPV_INTEL_task_sequence,
SPIRV::ExtensionID::SPV_INTEL_bfloat16_conversion,
SPIRV::ExtensionID::SPV_INTEL_joint_matrix,
SPIRV::ExtensionID::SPV_INTEL_hw_thread_queries,
SPIRV::ExtensionID::SPV_KHR_uniform_group_instructions,
SPIRV::ExtensionID::SPV_INTEL_masked_gather_scatter,
SPIRV::ExtensionID::SPV_INTEL_tensor_float32_conversion,
SPIRV::ExtensionID::SPV_INTEL_optnone,
SPIRV::ExtensionID::SPV_KHR_non_semantic_info,
SPIRV::ExtensionID::SPV_KHR_cooperative_matrix,
SPIRV::ExtensionID::SPV_EXT_shader_atomic_float16_add,
SPIRV::ExtensionID::SPV_INTEL_fp_max_error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will have to constantly keep this in sync with Clang.cpp

That is why I left a comment to consider introducing a unified config for both clang and jit-compiler :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've had this comment for multiple months now, so I think we should prepare for a non-trivial amount of time where this needs to be maintained manually.

I think investing a bit of time (e.g., using the list I posted above) now will save us maintenance burden in the next months.

We should probably also add a comment in Clang.cpp that the list is to be kept in sync with this location here, so that people enabling new extensions in Clang.cpp are aware they need to maintain this place.

@sommerlukas sommerlukas requested a review from jopperm March 7, 2025 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kernel_compiler_sycl_jit failed on Windows with SPV_EXT_optnone support.
2 participants