anv: Add anv_physical_device::has_cooperative_matrix

This flag tracks whether or not cooperative matrices are fully enabled
on the physica device (i.e., both the configs exist and the environment
varible is set).  This is mainly to support a later commit "anv: Set
PIPELINE_SELECT systolic mode enable flag."

This could be squashed into "anv: Implement VK_KHR_cooperative_matrix."
I left it separate because we might go back to the previous method.

v3: Don't hide the extension behind an environment variable
(ANV_COOPERATIVE_MATRIX) now the we have a better solution for setting
PIPELINE_SELECT.

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25994>
This commit is contained in:
Ian Romanick 2023-10-30 11:06:24 -07:00
parent 0a6f8b40bf
commit 67739b02de
3 changed files with 12 additions and 9 deletions

View file

@ -218,9 +218,6 @@ get_device_extensions(const struct anv_physical_device *device,
const bool rt_enabled = ANV_SUPPORT_RT && device->info.has_ray_tracing;
const bool cooperative_matrix_enabled =
anv_has_cooperative_matrix(&device->info);
*ext = (struct vk_device_extension_table) {
.KHR_8bit_storage = true,
.KHR_16bit_storage = !device->instance->no_16bit,
@ -229,7 +226,7 @@ get_device_extensions(const struct anv_physical_device *device,
.KHR_buffer_device_address = true,
.KHR_calibrated_timestamps = device->has_reg_timestamp,
.KHR_copy_commands2 = true,
.KHR_cooperative_matrix = cooperative_matrix_enabled,
.KHR_cooperative_matrix = anv_has_cooperative_matrix(device),
.KHR_create_renderpass2 = true,
.KHR_dedicated_allocation = true,
.KHR_deferred_host_operations = true,
@ -868,7 +865,7 @@ get_features(const struct anv_physical_device *pdevice,
.nestedCommandBufferSimultaneousUse = false,
/* VK_KHR_cooperative_matrix */
.cooperativeMatrix = anv_has_cooperative_matrix(&pdevice->info),
.cooperativeMatrix = anv_has_cooperative_matrix(pdevice),
};
/* The new DOOM and Wolfenstein games require depthBounds without
@ -2250,6 +2247,9 @@ anv_physical_device_try_create(struct vk_instance *vk_instance,
debug_get_bool_option("ANV_ENABLE_GENERATED_INDIRECT_DRAWS",
true);
device->has_cooperative_matrix =
device->info.cooperative_matrix_configurations[0].scope != SCOPE_NONE;
unsigned st_idx = 0;
device->sync_syncobj_type = vk_drm_syncobj_get_type(fd);
@ -5173,7 +5173,7 @@ VkResult anv_GetPhysicalDeviceCooperativeMatrixPropertiesKHR(
ANV_FROM_HANDLE(anv_physical_device, pdevice, physicalDevice);
const struct intel_device_info *devinfo = &pdevice->info;
assert(anv_has_cooperative_matrix(devinfo));
assert(anv_has_cooperative_matrix(pdevice));
VK_OUTARRAY_MAKE_TYPED(VkCooperativeMatrixPropertiesKHR, out, pProperties, pPropertyCount);

View file

@ -144,7 +144,7 @@ anv_shader_stage_to_nir(struct anv_device *device,
const bool rt_enabled = ANV_SUPPORT_RT && pdevice->info.has_ray_tracing;
const struct spirv_to_nir_options spirv_options = {
.caps = {
.cooperative_matrix = anv_has_cooperative_matrix(&pdevice->info),
.cooperative_matrix = anv_has_cooperative_matrix(pdevice),
.demote_to_helper_invocation = true,
.derivative_group = true,
.descriptor_array_dynamic_indexing = true,

View file

@ -1036,6 +1036,9 @@ struct anv_physical_device {
bool uses_relocs;
/** Can the platform support cooperative matrices and is it enabled? */
bool has_cooperative_matrix;
struct {
uint32_t family_count;
struct anv_queue_family families[ANV_MAX_QUEUE_FAMILIES];
@ -5805,9 +5808,9 @@ static inline void anv_perfetto_end_submit(struct anv_queue *queue,
#endif
static bool
anv_has_cooperative_matrix(const struct intel_device_info *info)
anv_has_cooperative_matrix(const struct anv_physical_device *device)
{
return info->cooperative_matrix_configurations[0].scope != SCOPE_NONE;
return device->has_cooperative_matrix;
}
#define ANV_FROM_HANDLE(__anv_type, __name, __handle) \