Skip to content

Commit

Permalink
Added HPU backend support for torch.compile tests. (#5269)
Browse files Browse the repository at this point in the history
Added HPU backend in torch.compile tests. HPU uses hpu_backend for
torch.compile.
  • Loading branch information
vshekhawat-hlab authored Mar 13, 2024
1 parent cf58c53 commit a6fb4d3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/unit/runtime/compile/test_compile_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def base_config():
"backend": "inductor"
}
}
if get_accelerator().device_name() == 'hpu':
config_dict['compile']['backend'] = 'hpu_backend'
return config_dict


Expand Down
2 changes: 2 additions & 0 deletions tests/unit/runtime/compile/test_compile_zero.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def test_compile_zero(self, tmpdir, zero_stage, dtype, offload_device):
}
}

if get_accelerator().device_name() == 'hpu':
config_dict['compile']['backend'] = 'hpu_backend'
if offload_device == OffloadDeviceEnum.cpu:
config_dict["zero_optimization"]["offload_optimizer"] = {"device": offload_device}
elif offload_device == OffloadDeviceEnum.nvme:
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/runtime/compile/test_load_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def base_config():
"backend": "inductor"
}
}

if get_accelerator().device_name() == 'hpu':
config_dict['compile']['backend'] = 'hpu_backend'
return config_dict


Expand Down

0 comments on commit a6fb4d3

Please sign in to comment.