On 21/10/2024 20:49, Tobias Burnus wrote:
I have now attached a proper version of my patch, which is relative to your patch.

OK once your patch is in?


     GCN_DEVICE field descriptions:
-      0  "name"  (text, external)
+      0 Generic flag/version (0 = non-generic, 1 to 255 = generic version,
+        external)

I think this should mention EF_AMDGPU_GENERIC_VERSION_V, otherwise it's just a magic number. Actually, where are the numbers defined? Is it just that the linker demands that they match, so we can define them ourselves?

Also, why does this have to be arg0? The whole point of using ellipsis everywhere is so we can add new fields without touching every instance that doesn't care.

You can add:

  GCN_DEVICE(gfx900, ...blah...
     /* Generic Arch Version */ 0 /* Not generic. */
  )

  GCN_DEVICE(gfx11-generic, ...blah...
     /* Generic Arch Version */ 1 /* Up to gfx1103 ? */
  )

and

 /Generic Arch Version.*[0-9]+/ {
   gen_ver = $6
   if (gen_ver > 0) {
     generic_list=(generic_list " OPT_" elf)
printf "\n#define GENERIC_%s \"march=%s:--amdhsa-code-object-version=6;\"", elf, gfx
   }
   next
 }

The "elf" (but see below) and "gfx" variables will have been set correctly, by this point, so it should work.

 /^GCN_DEVICE\(/ {
-  gfx=$2
-  list=(list " OPT_" gfx)
+  gen_ver=$2
+  gfx=$3
+  elf=$4
+  list=(list " OPT_" elf)

I understand that you needed to use the name variant that has underscores, but $4 should not be called "elf"; call it "GFX" or "NAME". The elf_flag is $5 here, so this confused me.

Andrew

Reply via email to