diff --git a/docs/features.txt b/docs/features.txt index 60225225ef5..8d6977878b2 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -889,13 +889,13 @@ Rusticl extensions: cl_khr_spirv_no_integer_wrap_decoration DONE cl_khr_spirv_queries DONE cl_khr_srgb_image_writes not started - cl_khr_subgroup_ballot not started - cl_khr_subgroup_clustered_reduce not started - cl_khr_subgroup_extended_types not started + cl_khr_subgroup_ballot DONE (asahi, iris, llvmpipe, radeonsi, zink) + cl_khr_subgroup_clustered_reduce DONE (asahi, llvmpipe, radeonsi, zink) + cl_khr_subgroup_extended_types DONE (asahi, iris, llvmpipe, radeonsi, zink) cl_khr_subgroup_named_barrier not started - cl_khr_subgroup_non_uniform_arithmetic not started - cl_khr_subgroup_non_uniform_vote not started - cl_khr_subgroup_rotate not started + cl_khr_subgroup_non_uniform_arithmetic DONE (asahi, llvmpipe, radeonsi, zink) + cl_khr_subgroup_non_uniform_vote DONE (asahi, iris, llvmpipe, radeonsi, zink) + cl_khr_subgroup_rotate DONE (llvmpipe, zink) cl_khr_subgroup_shuffle DONE (asahi, iris, llvmpipe, radeonsi, zink) cl_khr_subgroup_shuffle_relative DONE (asahi, iris, llvmpipe, radeonsi, zink) cl_khr_subgroups in progress diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index ebfe43421c2..c099009181e 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -23,3 +23,9 @@ VK_EXT_legacy_dithering on panvk GL_ARB_sample_shading on v3d VK_KHR_maintenance4 on pvr VK_ARM_scheduling_controls on panvk +cl_khr_subgroup_ballot on asahi, iris, llvmpipe, radeonsi and zink +cl_khr_subgroup_clustered_reduce on asahi, llvmpipe, radeonsi and zink +cl_khr_subgroup_extended_types on asahi, iris, llvmpipe, radeonsi and zink +cl_khr_subgroup_non_uniform_arithmetic on asahi, llvmpipe, radeonsi and zink +cl_khr_subgroup_non_uniform_vote on asahi, iris, llvmpipe, radeonsi and zink +cl_khr_subgroup_rotate on llvmpipe and zink diff --git a/src/gallium/frontends/rusticl/core/device.rs b/src/gallium/frontends/rusticl/core/device.rs index c3ee1df0abb..bac5df0f808 100644 --- a/src/gallium/frontends/rusticl/core/device.rs +++ b/src/gallium/frontends/rusticl/core/device.rs @@ -744,8 +744,36 @@ impl DeviceBase { add_cap(SpvCapability::SpvCapabilitySubgroupDispatch); // requires CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS //add_ext(1, 0, 0, "cl_khr_subgroups"); + add_ext(1, 0, 0, "cl_khr_subgroup_extended_types"); add_feat(1, 0, 0, "__opencl_c_subgroups"); + if self.subgroup_ballot_supported() { + add_cap(SpvCapability::SpvCapabilityGroupNonUniformBallot); + add_ext(1, 0, 0, "cl_khr_subgroup_ballot"); + } + + if self.subgroup_clustered_supported() { + add_cap(SpvCapability::SpvCapabilityGroupNonUniformClustered); + add_ext(1, 0, 0, "cl_khr_subgroup_clustered_reduce"); + } + + if self.subgroup_non_uniform_arithmetic_supported() { + add_cap(SpvCapability::SpvCapabilityGroupNonUniformArithmetic); + add_ext(1, 0, 0, "cl_khr_subgroup_non_uniform_arithmetic"); + } + + if self.subgroup_non_uniform_vote_supported() { + add_cap(SpvCapability::SpvCapabilityGroupNonUniform); + add_cap(SpvCapability::SpvCapabilityGroupNonUniformVote); + add_ext(1, 0, 0, "cl_khr_subgroup_non_uniform_vote"); + } + + if self.subgroup_rotate_supported() { + add_cap(SpvCapability::SpvCapabilityGroupNonUniformRotateKHR); + add_ext(1, 0, 0, "cl_khr_subgroup_rotate"); + add_spirv(c"SPV_KHR_subgroup_rotate"); + } + if self.subgroup_shuffle_supported() { add_cap(SpvCapability::SpvCapabilityGroupNonUniformShuffle); add_ext(1, 0, 0, "cl_khr_subgroup_shuffle"); @@ -1183,6 +1211,41 @@ impl DeviceBase { != 0 } + pub fn subgroup_ballot_supported(&self) -> bool { + self.subgroups_supported() + && self.screen().caps().shader_subgroup_supported_features + & PIPE_SHADER_SUBGROUP_FEATURE_BALLOT + != 0 + } + + pub fn subgroup_clustered_supported(&self) -> bool { + self.subgroups_supported() + && self.screen().caps().shader_subgroup_supported_features + & PIPE_SHADER_SUBGROUP_FEATURE_CLUSTERED + != 0 + } + + pub fn subgroup_non_uniform_arithmetic_supported(&self) -> bool { + self.subgroups_supported() + && self.screen().caps().shader_subgroup_supported_features + & PIPE_SHADER_SUBGROUP_FEATURE_ARITHMETIC + != 0 + } + + pub fn subgroup_non_uniform_vote_supported(&self) -> bool { + self.subgroups_supported() + && self.screen().caps().shader_subgroup_supported_features + & PIPE_SHADER_SUBGROUP_FEATURE_VOTE + != 0 + } + + pub fn subgroup_rotate_supported(&self) -> bool { + let mask = + PIPE_SHADER_SUBGROUP_FEATURE_ROTATE | PIPE_SHADER_SUBGROUP_FEATURE_ROTATE_CLUSTERED; + self.subgroups_supported() + && self.screen().caps().shader_subgroup_supported_features & mask == mask + } + pub fn subgroup_shuffle_supported(&self) -> bool { self.subgroups_supported() && self.screen().caps().shader_subgroup_supported_features @@ -1277,6 +1340,12 @@ impl DeviceBase { intel_subgroups: self.intel_subgroups_supported(), kernel_clock: self.kernel_clock_supported(), subgroups: subgroups_supported, + subgroups_ballot: self.subgroup_ballot_supported(), + subgroups_clustered: self.subgroup_clustered_supported(), + subgroups_extended_types: subgroups_supported, + subgroups_non_uniform_arithmetic: self.subgroup_non_uniform_arithmetic_supported(), + subgroups_non_uniform_vote: self.subgroup_non_uniform_vote_supported(), + subgroups_rotate: self.subgroup_rotate_supported(), subgroups_shuffle: self.subgroup_shuffle_supported(), subgroups_shuffle_relative: self.subgroup_shuffle_relative_supported(), ..Default::default()