microsoft/clc: Add shader model / validator to compiler API

Shader model 6.2 was the upper bounds of what *could* be generated
before, but not all devices support it. And other devices support
even more. So, let's pass in the shader model / validator that will
be used by the API caller.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21178>
This commit is contained in:
Jesse Natalie 2023-02-07 14:14:37 -08:00 committed by Marge Bot
parent cd03392c7e
commit 31778ac869
3 changed files with 8 additions and 2 deletions

View file

@ -975,8 +975,8 @@ clc_spirv_to_dxil(struct clc_libclc *lib,
.disable_math_refactoring = true,
.num_kernel_globals = num_global_inputs,
.environment = DXIL_ENVIRONMENT_CL,
.shader_model_max = SHADER_MODEL_6_2,
.validator_version_max = DXIL_VALIDATOR_1_4,
.shader_model_max = conf && conf->max_shader_model ? conf->max_shader_model : SHADER_MODEL_6_2,
.validator_version_max = conf ? conf->validator_version : DXIL_VALIDATOR_1_4,
};
for (unsigned i = 0; i < out_dxil->kernel->num_args; i++) {

View file

@ -25,6 +25,7 @@
#define CLC_COMPILER_H
#include "clc/clc.h"
#include "dxil_versions.h"
#ifdef __cplusplus
extern "C" {
@ -122,6 +123,9 @@ struct clc_runtime_kernel_conf {
unsigned lower_bit_size;
unsigned support_global_work_id_offsets;
unsigned support_workgroup_id_offsets;
enum dxil_shader_model max_shader_model;
enum dxil_validator_version validator_version;
};
struct clc_libclc_dxil_options {

View file

@ -483,6 +483,8 @@ ComputeTest::run_shader_with_raw_args(Shader shader,
// Older WARP and some hardware doesn't support int64, so for these tests, unconditionally lower away int64
// A more complex runtime can be smarter about detecting when this needs to be done
conf.lower_bit_size = 64;
conf.max_shader_model = SHADER_MODEL_6_2;
conf.validator_version = DXIL_VALIDATOR_1_4;
if (!shader.dxil->metadata.local_size[0])
conf.local_size[0] = compile_args.x;