Repository: pytorch
Issue: Do dynamo/inductor support custom classes like TorchScript.
Labels: module: docs,triaged,oncall: pt2,module: dynamo,vllm-compile

This is  a question i got from @bnellnm on the vllm-torch slack channel:

We have a CustomClassHolder class ScalarType defined [here](https://github.com/vllm-project/vllm/blob/main/csrc/core/scalar_type.hpp).  It's used in a few kernels.  In particular gptq_marlin_gemm.  There are some torch.library.opcheck tests for this op which pass but we are seeing graph breaks when this op is used.

```
     torch._dynamo.exc.Unsupported: call_function args: TensorVariable() TensorVariable() TensorVariable() TensorVariable() TensorVariable() TensorVariable() TensorVariable() UserDefinedObjectVariable(ScriptObject) ConstantVariable(int: 2048) ConstantVariable(int: 6144) ConstantVariable(int: 4096) ConstantVariable(bool: True) ConstantVariable(bool: False) ConstantVariable(bool: True) 
E           
E           from user code:
E              File "/home/lsakka/vllm/vllm/model_executor/models/llama.py", line 429, in forward
E               model_output = self.model(input_ids, positions, kv_caches,
E             File "/home/lsakka/vllm/vllm/model_executor/models/llama.py", line 329, in forward
E               hidden_states, residual = layer(
E             File "/home/lsakka/vllm/vllm/model_executor/models/llama.py", line 251, in forward
E               hidden_states = self.self_attn(
E             File "/home/lsakka/vllm/vllm/model_executor/models/llama.py", line 178, in forward
E               qkv, _ = self.qkv_proj(hidden_states)
E             File "/home/lsakka/vllm/vllm/model_executor/layers/linear.py", line 358, in forward
E               output_parallel = self.quant_method.apply(self, input_, bias)
E             File "/home/lsakka/vllm/vllm/model_executor/layers/quantization/gptq_marlin.py", line 320, in apply
E               return apply_gptq_marlin_linear(
E             File "/home/lsakka/vllm/vllm/model_executor/layers/quantization/utils/marlin_utils.py", line 252, in apply_gptq_marlin_linear
E               output = ops.gptq_marlin_gemm(reshaped_x,
E             File "/home/lsakka/vllm/vllm/_custom_ops.py", line 28, in wrapper
E               return fn(*args, **kwargs)
E             File "/home/lsakka/vllm/vllm/_custom_ops.py", line 462, in gptq_marlin_gemm
E               return torch.ops._C.gptq_marlin_gemm(a, b_q_weight, b_scales, b_zeros,
E           
E           Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information
E           
E           
E           You can suppress this exception and fall back to eager by setting:
E               import torch._dynamo
E               torch._dynamo.config.suppress_errors = True

../pytorch/torch/_dynamo/exc.py:288: Unsupported
```
VVLM repo:
export VLLM_TEST_DYNAMO_GRAPH_CAPTURE=1
export VLLM_TEST_DYNAMO_FULLGRAPH_CAPTURE=1

pytest -s tests/models/test_gptq_marlin.py::test_models[5-32-half-model0]
cc @svekars @brycebortree @ezyang @chauhang @penguinwu @rec @zou3519 @voznesenskym @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @amjames