Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/infinicore/nn/rope.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ void RoPE::initialize_cache() {
|| device_.getType() == Device::Type::METAX
|| device_.getType() == Device::Type::ILUVATAR
|| device_.getType() == Device::Type::CAMBRICON
|| device_.getType() == Device::Type::HYGON)
|| device_.getType() == Device::Type::HYGON
|| device_.getType() == Device::Type::ASCEND)
&& !mrope_section_) {
INFINICORE_NN_BUFFER_INIT(cos_sin_cache, ({max_seq_len_, rotary_dim_}, dtype_, device_));
}
Expand Down
4 changes: 4 additions & 0 deletions src/infinicore/ops/infiniops_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ inline infini::ops::Device toInfiniOpsDevice(const Device &device) {
return infini::ops::Device{infini::ops::Device::Type::kCambricon, static_cast<int>(device.getIndex())};
case Device::Type::HYGON:
return infini::ops::Device{infini::ops::Device::Type::kHygon, static_cast<int>(device.getIndex())};
case Device::Type::ASCEND:
return infini::ops::Device{infini::ops::Device::Type::kAscend, static_cast<int>(device.getIndex())};
default:
throw std::runtime_error("InfiniOps backend does not support this device type.");
}
Expand All @@ -72,6 +74,7 @@ inline bool isSupportedDevice(Device::Type device_type) {
case Device::Type::ILUVATAR:
case Device::Type::CAMBRICON:
case Device::Type::HYGON:
case Device::Type::ASCEND:
return true;
default:
return false;
Expand All @@ -86,6 +89,7 @@ void registerSupportedDevices(Dispatcher &dispatcher, Function function) {
dispatcher.registerDevice(Device::Type::ILUVATAR, function);
dispatcher.registerDevice(Device::Type::CAMBRICON, function);
dispatcher.registerDevice(Device::Type::HYGON, function);
dispatcher.registerDevice(Device::Type::ASCEND, function);
}

struct TensorMeta {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ void *plan(const Tensor &positions,
|| device_type == Device::Type::METAX
|| device_type == Device::Type::ILUVATAR
|| device_type == Device::Type::CAMBRICON
|| device_type == Device::Type::HYGON);
|| device_type == Device::Type::HYGON
|| device_type == Device::Type::ASCEND);
return new PlannedMeta{
TensorMeta(positions),
TensorMeta(query),
Expand Down Expand Up @@ -94,6 +95,9 @@ static bool registered = []() {
RotaryEmbedding::plan_dispatcher().registerDevice(Device::Type::HYGON, &plan);
RotaryEmbedding::run_dispatcher().registerDevice(Device::Type::HYGON, &run);
RotaryEmbedding::cleanup_dispatcher().registerDevice(Device::Type::HYGON, &cleanup);
RotaryEmbedding::plan_dispatcher().registerDevice(Device::Type::ASCEND, &plan);
RotaryEmbedding::run_dispatcher().registerDevice(Device::Type::ASCEND, &run);
RotaryEmbedding::cleanup_dispatcher().registerDevice(Device::Type::ASCEND, &cleanup);
return true;
}();

Expand Down
2 changes: 2 additions & 0 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ local function configure_infiniops_ops(infiniops_ops, xmake_os, json)
local implementations = "all"
if use_linked_implementation then
implementations = {16}
elseif has_config("ascend-npu") and op == "argmax" then
implementations = {0}
elseif op == "argmax" or op == "index_select" then
implementations = {8}
elseif op == "rms_norm" or op == "silu_and_mul" or op == "topk_softmax" then
Expand Down
Loading