Thanks to the information in the AMD CAL programming guide v2.0 and the various ISA manuals I've been able to almost completely understand the form of cal image binaries for the various cards and shader types. The plan was to use the provided information in a fruitful way and write my own simple assembler for CAL.
However, unfortunately the documentation does not list the actual numerical values associated with the cal note header type identifiers (see e.g. table B3). Rather than deducing them would it be possible for AMD to provide these?
One nice way to do this might be to provide header files with the appropriate enums/defines in them.
An additional, more complicated issue, comes in the form of the programinfo note. More information is really needed to be able to straightforwardly use this. The note is described as containing a list of address, value pairs and only changes a little bit between shaders/cards. For a simple 770 pixel shader it looks like:
The "low" addresses, when multiplied by four, and contents are by and large consistent with the disassembly output (e.g. cf. SQ_PGM_RESOURCES_PS and a214) and what is in the R6xx_3D_Registers.pdf file. Each of these lines could be interpreted as a pm4 type-0 command packet as described in R6xx_R7xx_3D.pdf . One or two numbers don't quite match up though.
The "high" addresses look like pm4 type-2 filler packets, but they have some information in the reserved field and an associated value, so it would be strange if they actually were fillers. What are these?
In most cases most fields are zero so the non-trivial information required should not be too great. (Compute shaders for cypress/cayman are a little more complicated but not overly so.)
My feeling is that the entire programinfo note is a function of only a few variables of the kernel, such as its inputs, outputs, resources and numbers of gprs used, so it should be possible to write/use a function that outputs a suitable programinfo note given those variables.
Any help much appreciated,