def method_nikhilam_quantized():
    """
    Nikhilam: Deficiency from base.
    Quantize to int8 for 4x speedup on modern hardware.
    """
    # Quantize to int8
    scale_x = 127.0 / (x.abs().max() + 1e-6)
    scale_w = 127.0 / (w.abs().max() + 1e-6)
    
    x_q = (x * scale_x).round().to(torch.int8)
    w_q = (w * scale_w).round().to(torch.int8)
    
    # Int8 convolution (faster on CPU with AVX2)
    out_q = F.conv2d(x_q.float(), w_q.float(), padding=1)
    
    # Scale back
    scale_out = 1.0 / (scale_x * scale_w)
    return out_q * scale_out

_ = benchmark(method_nikhilam_quantized, "Nikhilam quantized (int8)", runs=100)

from concurrent.futures import ThreadPoolExecutor

def method_dhwajank_parallel():
    """
    Dhwajank (Flag Division): Parallel computation across output channels.
    Each "flag" handles a group of output channels independently.
    """
    n_flags = 4  # 4 workers
    channel_groups = np.array_split(range(K), n_flags)
    
    def conv_group(group_ids):
        w_group = w[group_ids]
        return F.conv2d(x, w_group, padding=1)
    
    # Parallel execution
    with ThreadPoolExecutor(max_workers=n_flags) as executor:
        results = list(executor.map(conv_group, channel_groups))
    
    # Concatenate results
    return torch.cat(results, dim=1)

_ = benchmark(method_dhwajank_parallel, "Dhwajank parallel (4 channel groups)", runs=100)
