code: def init_buffer(cai_linear, use_act_order=False):
      global max_dq_buffer_size
      global max_input_len
      global max_dq_buffer_size
      global max_inner_outer_dim
      global gptq_temp_dq_buffer
      global gptq_temp_state_buffer
  
      max_dq_buffer_size = max(
          max_dq_buffer_size, cai_linear.qweight.numel() * 8
      )
  
      if use_act_order:
          max_inner_outer_dim = max(
              max_inner_outer_dim,
              cai_linear.infeatures,
              cai_linear.outfeatures,
          )
  
      if use_act_order:
          max_input_len = 4096
      # The temp_state buffer is required to reorder X in the act-order case.
      # The temp_dq buffer is required to dequantize weights when using cuBLAS, typically for the prefill.
      gptq_temp_state_buffer = torch.zeros(
          (max_input_len, max_inner_outer_dim),
          dtype=torch.float16,
          device=torch.cuda.current_device(),
      )
      gptq_temp_dq_buffer = torch.zeros(
          (1, max_dq_buffer_size),
          dtype=torch.float16,
          device=torch.cuda.current_device(),
      )
  
      gptq_cuda.prepare_buffers(
          torch.device(torch.cuda.current_device()),
          gptq_temp_state_buffer,
          gptq_temp_dq_buffer,
      )
      # Using the default from exllama repo here.
      matmul_recons_thd = 8
      matmul_fused_remap = False
      matmul_no_half2 = False
      gptq_cuda.set_tuning_params(
          matmul_recons_thd, matmul_fused_remap, matmul_no_half2
      )
  
file_path: ColossalAI/tests/test_gptq/test_gptq_linear.py
imports: import math
  import time
  import numpy
  import pytest
  import torch
  import torch.nn
  import transformers
  from packaging import version
  import warnings
label_desc: Use image node_id 1 for calling a global function with example usage: init_buffer(cai_linear, use_act_order) without return types