# Inlining a custom triton kernel

**URL:** <https://dev-discuss.pytorch.org/t/inlining-a-custom-triton-kernel/2305>\
**Category:** compiler\
**Created:** [July 22, 2024, 7:55pm UTC](https://dev-discuss.pytorch.org/t/inlining-a-custom-triton-kernel/2305 "2024-07-22T19:55:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fhossein-quic](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/fhossein-quic/32/1341_2.png) [@fhossein-quic](https://dev-discuss.pytorch.org/u/fhossein-quic)\
**Post date:** [July 22, 2024, 7:55pm UTC](https://dev-discuss.pytorch.org/t/inlining-a-custom-triton-kernel/2305/1 "2024-07-22T19:55:09Z")

</div>

Hi all,  
I have a custom backend, and can successfully generate triton codes torch models via torchInductor and run them on my tritn backend. I am trying to incorporate user-defined triton kernels by following the example in [Using User-Defined Triton Kernels with torch.compile — PyTorch Tutorials 2.4.0+cu124 documentation](https://pytorch.org/tutorials/recipes/torch_compile_user_defined_triton_kernel_tutorial.html). However, for me, the example breaks with this failure:

> torch.\_dynamo.exc.Unsupported: builtin: setattr [\<class ‘torch.\_dynamo.variables.functions.UserFunctionVariable’\>, \<class ‘torch.\_dynamo.variables.constant.ConstantVariable’\>, \<class ‘torch.\_dynamo.variables.functions.UserFunctionVariable’\>] False

The issue seems to be raised by the inlining process. It comes from this line [pytorch/torch/\_dynamo/symbolic\_convert.py at main · pytorch/pytorch (github.com)](https://github.com/pytorch/pytorch/blob/main/torch/_dynamo/symbolic_convert.py#L1647-#L1649) in dynamo.

I dumped the inst:  
`Instruction(opcode=95, opname='STORE_ATTR', arg=3, argval='excepthook_ori', offset=16, starts_line=67, is_jump_target=False, positions=None, target=None, exn_tab_entry=None)`

Note:If I set `fullgraph=Flase` everything works as they should but it lowers the model’s performance.

How should I resolve the issue when `fullgraph=True`?
