I am currently working on creating a new dialect following the Toy tutorial for a demo at my workplace. It’s a tensor-level dialect for an accelerator, and I needed to create a custom type (because the standard tensor types do not track necessary information about strides or hardware level memory spaces which I need to keep track of).
My CustomTensorType is a collection of shape information, element type, and memory space. Ultimately, I want to lower CustomTensorType to a named struct at the LLVM IR level. This must conform to the expectations of an existing backend: an LLVM struct with a specific type name, fixed number of parameters, and integer bit widths for specific elements. I noticed that in the Toy tutorial, the first six chapters use standard types, and when a new type is introduced in Ch7, the dialect hook “materializeConstant” is used so that the struct can be “generated to LLVM without any changes to our pipeline” (Ch7). I couldn’t find much help figuring out how to lower my custom type with more control. I’m not really sure where to start, and would be grateful for any help.
Are there any good tutorials or examples of lowering a custom type to the LLVM dialect, where some control is needed to output a specific representation?
Thanks in advance!