from vllm.worker.worker import Worker
from vllm_mlu.mlu_hijack_utils import MluHijackObject

@property
def vllm__worker__worker__Worker__do_metadata_broadcast(self) -> bool:
    '''
    =============================
    Modify by Context Parallel
    =============================
    @brief: do metadata broadcast if cp or tp > 1.
    '''
    return self.parallel_config.world_size > 1
    '''
    ==========================
    End of Context Parallel
    ==========================
    '''


MluHijackObject.apply_hijack(
    Worker,
    Worker.do_metadata_broadcast,
    vllm__worker__worker__Worker__do_metadata_broadcast)
