UMA TIR Pass for composite functions (multiple operators)

Hi,

I want to run a composite function of “conv2d” and “add” on a custom accelerator using UMA. I’ve written the related pattern but for the lowering process, I have an issue. I found that we can not act like BYOC here (sequentially sending every composite Relay function with Compiler=your_accelerator to the codegen). Here in UMA, the lowered function would be converted to TIR, and then using a TIR pass (like the vanilla example) it would be replaced with the external function. The TIR module for the partitioned composite function has two separate blocks for conv and add. I am not sure how to map the composite function to the external one. Should I combine the two blocks before TIR pass or write a pass to handle both blocks and map them to one function?

I am pretty new to TVM and one example would help me a lot…

@comaniac

@cgerum
@mjklaiber

any advice? :slight_smile:

I could solve my problem but I couldn’t remove this post :slight_smile:

1 Like

@SamiraAhm ,can you describe the solution you took for the community?

Thanks!

Sure. However, I am not sure about my solution. I found that maybe there is no need to combine the blocks of addition and convolution. The pattern that I defined for the composite function replaces both the add and conv2d. So in the TIR pass, it should just search for the compute block of conv2d that has all the arguments that are required for the Vanilla call function (which calculates conv2d and add).