Coverage for src/flag_gems/runtime/backend/_kunlunxin/ops/addcmul.py: 0%
15 statements
« prev ^ index » next coverage.py v7.6.9, created at 2026-03-23 02:03 +0800
« prev ^ index » next coverage.py v7.6.9, created at 2026-03-23 02:03 +0800
1import logging
3import torch
4import triton
6from ..utils.pointwise_dynamic import pointwise_dynamic
8logger = logging.getLogger("flag_gems").getChild(__name__.lstrip("."))
11@pointwise_dynamic(
12 is_tensor=[True, True, True, False], promotion_methods=[(0, 1, 2, "DEFAULT")]
13)
14@triton.jit
15def addcmul_forward(x, t1, t2, value):
16 return x + value * t1 * t2
19def addcmul(inp, tensor1, tensor2, *, value=1.0, out=None):
20 logger.debug("GEMS ADDCMUL FORWARD")
21 if out is None:
22 out = torch.empty_like(inp)
23 addcmul_forward(inp, tensor1, tensor2, value, out0=out)
24 return out