ac/llvm,radeonsi: lower nir_load_user_data_amd in abi
authorQiang Yu <yuq825@gmail.com>
Tue, 6 Jun 2023 03:26:56 +0000 (11:26 +0800)
committerMarge Bot <emma+marge@anholt.net>
Tue, 13 Jun 2023 03:41:02 +0000 (03:41 +0000)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23540>

src/amd/llvm/ac_nir_to_llvm.c
src/amd/llvm/ac_shader_abi.h
src/gallium/drivers/radeonsi/si_nir_lower_abi.c
src/gallium/drivers/radeonsi/si_shader_llvm.c

index 0e36b6e..077b5d7 100644 (file)
@@ -3172,10 +3172,6 @@ static bool visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins
    case nir_intrinsic_is_helper_invocation:
       result = ac_build_load_helper_invocation(&ctx->ac);
       break;
-   case nir_intrinsic_load_user_data_amd:
-      assert(LLVMTypeOf(ctx->abi->user_data) == ctx->ac.v4i32);
-      result = ctx->abi->user_data;
-      break;
    case nir_intrinsic_load_instance_id:
       result = ctx->abi->instance_id_replaced ?
          ctx->abi->instance_id_replaced : ctx->abi->instance_id;
index 5b6f5a8..d505482 100644 (file)
@@ -29,7 +29,6 @@ struct ac_shader_abi {
    LLVMValueRef vertex_id;
    LLVMValueRef vs_rel_patch_id;
    LLVMValueRef instance_id;
-   LLVMValueRef user_data;
 
    /* replaced registers when culling enabled */
    LLVMValueRef vertex_id_replaced;
index f991ebc..02d48ef 100644 (file)
@@ -708,6 +708,10 @@ static bool lower_intrinsic(nir_builder *b, nir_instr *instr, struct lower_abi_s
          s->gsvs_ring[stream_id] : nir_ssa_undef(b, 4, 32);
       break;
    }
+   case nir_intrinsic_load_user_data_amd:
+      replacement = ac_nir_load_arg(b, &args->ac, args->cs_user_data);
+      replacement = nir_pad_vec4(b, replacement);
+      break;
    default:
       return false;
    }
index 44a38b6..a2f3ed2 100644 (file)
@@ -793,12 +793,6 @@ static bool si_llvm_translate_nir(struct si_shader_context *ctx, struct si_shade
    }
 
    case MESA_SHADER_COMPUTE:
-      if (nir->info.cs.user_data_components_amd) {
-         ctx->abi.user_data = ac_get_arg(&ctx->ac, ctx->args->cs_user_data);
-         ctx->abi.user_data = ac_build_expand_to_vec4(&ctx->ac, ctx->abi.user_data,
-                                                      nir->info.cs.user_data_components_amd);
-      }
-
       if (ctx->shader->selector->info.base.shared_size)
          si_llvm_declare_compute_memory(ctx);
       break;