Skip to content

Commit

Permalink
[KUNLUNXIN] bugfix for op 'all' (FlagOpen#720)
Browse files Browse the repository at this point in the history
Co-authored-by: w4yne <[email protected]>
  • Loading branch information
w4yne and w4yne authored Aug 27, 2024
1 parent 8ea31a2 commit b985f77
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions operation/benchmarks/all/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ def main(config, case_config):


m = case_config.Melements
# default shape: M * 1024 * 1024
shape = m * 1024 * 1024
# default arange: 0, M * 1024 * 1024
arange_end = m * 1024 * 1024

if config.vendor == 'kunlunxin':
# if `Shape' specified in `case_config.yaml', use it
if case_config.__contains__('Shape') and case_config.Shape is not None:
shape = case_config.Shape
arange_end = math.prod(case_config.Shape)

a = torch.arange(0, math.prod(shape)).to(0)
a = torch.arange(0, arange_end).to(0)
print(f'Shape for performance_test: {a.shape}')

latency_nowarm, latency_warm, cputime, kerneltime = do_test(
torch.all, (a, ), host_device_sync, config, case_config)

op2flops = lambda x: x * math.prod(shape)
op2flops = lambda x: x * arange_end

perf_result = cal_perf(cputime, kerneltime, op2flops,
config.spectflops)
Expand Down

0 comments on commit b985f77

Please sign in to comment.