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
2 changes: 1 addition & 1 deletion src/infinicore/nn/rope.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void RoPE::initialize_cache() {
INFINICORE_NN_BUFFER_INIT(cos_cache, ({max_seq_len_, cache_dim}, dtype_, device_));

#ifdef ENABLE_INFINIOPS_API
if (device_.getType() == Device::Type::NVIDIA && !mrope_section_) {
if ((device_.getType() == Device::Type::NVIDIA || device_.getType() == Device::Type::METAX) && !mrope_section_) {
INFINICORE_NN_BUFFER_INIT(cos_sin_cache, ({max_seq_len_, rotary_dim_}, dtype_, device_));
}
#endif
Expand Down
4 changes: 3 additions & 1 deletion src/infinicore/ops/random_sample/random_sample.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ namespace {
#ifdef ENABLE_INFINIOPS_API
bool tryGreedyWithInfiniOps(Tensor indices, Tensor logits, int topk) {
const auto dtype = logits->dtype();
if (logits->device().getType() != Device::Type::NVIDIA
const auto device_type = logits->device().getType();
if ((device_type != Device::Type::NVIDIA
&& device_type != Device::Type::METAX)
|| topk != 1
|| logits->ndim() != 1
|| logits->numel() == 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void *plan(const Tensor &positions,
bool is_neox,
int64_t rope_dim_offset,
bool inverse) {
INFINICORE_ASSERT(query->device().getType() == Device::Type::NVIDIA);
INFINICORE_ASSERT(query->device().getType() == Device::Type::NVIDIA || query->device().getType() == Device::Type::METAX);
return new PlannedMeta{
TensorMeta(positions),
TensorMeta(query),
Expand Down Expand Up @@ -77,6 +77,9 @@ static bool registered = []() {
RotaryEmbedding::plan_dispatcher().registerDevice(Device::Type::NVIDIA, &plan);
RotaryEmbedding::run_dispatcher().registerDevice(Device::Type::NVIDIA, &run);
RotaryEmbedding::cleanup_dispatcher().registerDevice(Device::Type::NVIDIA, &cleanup);
RotaryEmbedding::plan_dispatcher().registerDevice(Device::Type::METAX, &plan);
RotaryEmbedding::run_dispatcher().registerDevice(Device::Type::METAX, &run);
RotaryEmbedding::cleanup_dispatcher().registerDevice(Device::Type::METAX, &cleanup);
return true;
}();

Expand Down
2 changes: 1 addition & 1 deletion xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ local function build_infiniops_external(xmake_os)
"-DGENERATE_PYTHON_BINDINGS=OFF",
"-DCMAKE_BUILD_TYPE=Release"
}
if has_config("nv-gpu") then
if has_config("nv-gpu") or has_config("metax-gpu") then
table.insert(cmake_config_args, "-DWITH_TORCH=ON")
table.insert(cmake_config_args, "-DINFINI_OPS_TORCH_OPS=argmax")
end
Expand Down
Loading