diff --git a/src/compiler/isaspec/encode.py b/src/compiler/isaspec/encode.py index acaa45703b6..3129c7c9bef 100755 --- a/src/compiler/isaspec/encode.py +++ b/src/compiler/isaspec/encode.py @@ -391,6 +391,11 @@ store_instruction(BITSET_WORD *dst, bitmask_t instr) */ struct encode_state; +/** + * Allows to use gpu_id in expr functions + */ +#define ISA_GPU_ID() s->gen + struct bitset_params; static bitmask_t diff --git a/src/compiler/isaspec/isaspec_decode_decl.h b/src/compiler/isaspec/isaspec_decode_decl.h index db1402b1474..1c6794c4d37 100644 --- a/src/compiler/isaspec/isaspec_decode_decl.h +++ b/src/compiler/isaspec/isaspec_decode_decl.h @@ -61,6 +61,12 @@ void isa_decode_bitset(void *out, const struct isa_bitset **bitsets, struct deco /** * Used by generated decode functions */ +uint32_t isa_get_gpu_id(struct decode_scope *scope); + +/** + * Allows to use gpu_id in expr functions + */ +#define ISA_GPU_ID() isa_get_gpu_id(scope) /** * For bitset fields, there are some cases where we want to "remap" field diff --git a/src/compiler/isaspec/isaspec_decode_impl.c b/src/compiler/isaspec/isaspec_decode_impl.c index 32fc07b5d11..ce4af3db227 100644 --- a/src/compiler/isaspec/isaspec_decode_impl.c +++ b/src/compiler/isaspec/isaspec_decode_impl.c @@ -557,6 +557,12 @@ isa_decode_field(struct decode_scope *scope, const char *field_name) return bitmask_to_uint64_t(val); } +uint32_t +isa_get_gpu_id(struct decode_scope *scope) +{ + return scope->state->options->gpu_id; +} + static void display_field(struct decode_scope *scope, const char *field_name) {