• Members 9 posts
    2026年1月20日 11:44
    #ifdef USE_METAX
    #include <maca_cooperative_groups.h>
    #include <maca_reduce.h>
    #include <maca_fp16.h>
    #include "math_utils.cuh"
    #include <mma.h>
    #include <assert.h>
    // for wmma
    using namespace mxmaca;
    #else
    #include <cooperative_groups.h>
    #include <cooperative_groups/reduce.h>
    #include "cuda_fp16.h"
    #include "math_utils.cuh"
    #include "mma.h"
    #include <assert.h>
    // for wmma
    using namespace nvcuda;
    #endif
    

    我这边在做国产化的适配,nvidia是mma.h和 namespace nvcude。请问沐曦对应的头文件在哪个path?哪个文件?namespace是mxmaca吗?

    找到一堆mma.h,有没有例子?找的太费劲了

    find /opt/maca-3.3.0/ -name *mma.h
    /opt/maca-3.3.0/include/mctlass/arch/mma.h
    /opt/maca-3.3.0/include/mctlass/arch/wmma.h
    /opt/maca-3.3.0/include/mctlass/gemm/warp/mma_tensor_op_wmma.h
    /opt/maca-3.3.0/include/mctlass/gemm/warp/mma_tensor_op_tile_iterator_wmma.h
    /opt/maca-3.3.0/include/mctlass/gemm/warp/mma.h
    /opt/maca-3.3.0/include/mctlass/gemm/thread/mma.h
    /opt/maca-3.3.0/include/mctlass/gemm/threadblock/maca_default_mma.h
    /opt/maca-3.3.0/include/mctlass/gemm/threadblock/maca_default_moe_mma.h
    /opt/maca-3.3.0/include/mctlass/gemm/threadblock/default_mma_core_wmma.h
    /opt/maca-3.3.0/include/mctlass/gemm/threadblock/maca_default_masked_grouped_mma.h
    /opt/maca-3.3.0/include/mctlass/gemm/threadblock/default_sparse_mma.h
    /opt/maca-3.3.0/include/mctlass/gemm/threadblock/maca_default_contiguous_grouped_mma.h
    /opt/maca-3.3.0/include/mctlass/gemm/threadblock/default_mma.h
    /opt/maca-3.3.0/include/mctlass/gemm/threadblock/maca_default_group_mma.h
    
  • Members 9 posts
    2026年1月20日 11:49
    INCLUDE_DIRECTORIES(${MACA_CLANG_PATH}/../lib)
    INCLUDE_DIRECTORIES(${MACA_PATH}/include/)
    INCLUDE_DIRECTORIES(${MACA_PATH}/include/mcfft/)
    INCLUDE_DIRECTORIES(${MACA_PATH}/include/mcr/)
    INCLUDE_DIRECTORIES(${MACA_PATH}/include/common/)
    INCLUDE_DIRECTORIES(${MACA_PATH}/include/mctlass/arch)
    LINK_DIRECTORIES(${MACA_PATH}/lib)
    

    指定${MACA_PATH}/include/mctlass/arch下的mma.h,编译报错

    .cpp:22:17: error: expected namespace name
       22 | using namespace mxmaca;
          |                 ^
    .cpp:405:13: error: use of undeclared identifier 'wmma'
      405 |             wmma::fragment<wmma::matrix_a, m, n, k, half, wmma::row_major> a_frag;
          |             ^
    :405:28: error: use of undeclared identifier 'wmma'
      405 |             wmma::fragment<wmma::matrix_a, m, n, k, half, wmma::row_major> a_frag;
          |                            ^
    .cpp:412:13: error: use of undeclared identifier 'wmma'
      412 |             wmma::fill_fragment(c_frag, 0);
    
    .cpp:419:16: error: use of undeclared identifier 'wmma'
      419 |                wmma::mma_sync(c_frag, a_frag, b_frag, c_frag);
          |                ^
    .cpp:433:13: error: use of undeclared identifier 'wmma'
      433 |             wmma::store_matrix_sync(store_addr, c_frag, store_ldm, wmma::mem_row_major);
          |             ^
    .cpp:433:68: error: use of undeclared identifier 'wmma'
      433 |             wmma::store_matrix_sync(store_addr, c_frag, store_ldm, wmma::mem_row_major);
    
  • Members 221 posts
    2026年1月20日 17:39

    尊敬的开发者您好,请联系接口人请求技术支持。

  • arrow_forward

    Thread has been moved from 公共.

  • Members 9 posts
    2026年1月23日 10:06
    #include <cmath>
    #include <maca_cooperative_groups.h>
    #include <maca_reduce.h>
    #include <maca_fp16.h>
    #include <assert.h>
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    
    //#include <__clang_maca_mma_functions.h>
    #include "mctlass/arch/wmma.h"
    
    using namespace mxmaca;
    
    // WMMA kernel: 16x16x16 matrix multiplication
    //__device__ void wmma_ker(half *a, half *b, float *c) {
    __host__ __device__ void wmma_ker(half *a, half *b, float *c) {
        wmma::fragment<wmma::matrix_a, 16, 16, 16, half, wmma::col_major> a_frag;
        wmma::fragment<wmma::matrix_b, 16, 16, 16, half, wmma::row_major> b_frag;
        wmma::fragment<wmma::accumulator, 16, 16, 16, float> c_frag;
    
        wmma::fill_fragment(c_frag, 0.0f);
    
        wmma::load_matrix_sync(a_frag, a, 16);
        wmma::load_matrix_sync(b_frag, b, 16);
        wmma::mma_sync(c_frag, a_frag, b_frag, c_frag);
    
        wmma::store_matrix_sync(c, c_frag, 16, wmma::mem_row_major);
    }
    
    
    int main() {
    }
    
    root@master2:/opt/caosiyuan/share/gitee.com/maca-samples/0_Introduction/asyncExec# make
    /opt/maca/mxgpu_llvm/bin/mxcc -x maca  -offload-arch native  asyncExec.cpp -o asyncExec --maca-path=/opt/maca
    asyncExec.cpp:39:17: error: expected namespace name
       39 | using namespace mxmaca;
          |                 ^
    asyncExec.cpp:44:5: error: use of undeclared identifier 'wmma'
       44 |     wmma::fragment<wmma::matrix_a, 16, 16, 16, half, wmma::col_major> a_frag;
          |     ^
    asyncExec.cpp:44:20: error: use of undeclared identifier 'wmma'
       44 |     wmma::fragment<wmma::matrix_a, 16, 16, 16, half, wmma::col_major> a_frag;
          |                    ^
    asyncExec.cpp:45:5: error: use of undeclared identifier 'wmma'
       45 |     wmma::fragment<wmma::matrix_b, 16, 16, 16, half, wmma::row_major> b_frag;
          |     ^
    asyncExec.cpp:45:20: error: use of undeclared identifier 'wmma'
       45 |     wmma::fragment<wmma::matrix_b, 16, 16, 16, half, wmma::row_major> b_frag;
          |                    ^
    asyncExec.cpp:46:5: error: use of undeclared identifier 'wmma'
       46 |     wmma::fragment<wmma::accumulator, 16, 16, 16, float> c_frag;
          |     ^
    asyncExec.cpp:46:20: error: use of undeclared identifier 'wmma'
       46 |     wmma::fragment<wmma::accumulator, 16, 16, 16, float> c_frag;
          |                    ^
    asyncExec.cpp:48:5: error: use of undeclared identifier 'wmma'
       48 |     wmma::fill_fragment(c_frag, 0.0f);
          |     ^
    asyncExec.cpp:50:5: error: use of undeclared identifier 'wmma'
       50 |     wmma::load_matrix_sync(a_frag, a, 16);
          |     ^
    asyncExec.cpp:51:5: error: use of undeclared identifier 'wmma'
       51 |     wmma::load_matrix_sync(b_frag, b, 16);
          |     ^
    asyncExec.cpp:52:5: error: use of undeclared identifier 'wmma'
       52 |     wmma::mma_sync(c_frag, a_frag, b_frag, c_frag);
          |     ^
    asyncExec.cpp:54:5: error: use of undeclared identifier 'wmma'
       54 |     wmma::store_matrix_sync(c, c_frag, 16, wmma::mem_row_major);
          |     ^
    asyncExec.cpp:54:44: error: use of undeclared identifier 'wmma'
       54 |     wmma::store_matrix_sync(c, c_frag, 16, wmma::mem_row_major);
          |                                            ^
    13 errors generated when compiling for host.
    make: *** [Makefile:44: asyncExec] Error 1
    
    
    # cat Makefile
    # Location of the MACA Toolkit
    MACA_PATH ?= /opt/maca
    
    # Compiler
    MXCC           = $(MACA_PATH)/mxgpu_llvm/bin/mxcc
    
    # Internel flags
    MXCCFLAGS     := -x maca
    #ARCHFLAGS     := -offload-arch native
    ARCHFLAGS     := -offload-arch native
    #ARCHFLAGS     := -offload-arch mx1
    ################################################################################
    # Target rules
    all: asyncExec
    
    asyncExec: asyncExec.cpp
            $(MXCC) $(MXCCFLAGS) $(ARCHFLAGS) $< -o $@ --maca-path=$(MACA_PATH)
    
    run: asyncExec
            ./asyncExec
    
    clean:
            rm -rf asyncExec asyncExec.o tdump.mem tdump.txt
    
  • Members 9 posts
    2026年1月23日 10:13
    mx-smi
    mx-smi  version: 2.1.10
    
    =================== MetaX System Management Interface Log ===================
    Timestamp                                         : Fri Jan 23 02:13:41 2026
    
    Attached GPUs                                     : 1
    +---------------------------------------------------------------------------------+
    | MX-SMI 2.1.10                       Kernel Mode Driver Version: 2.11.12         |
    | MACA Version: 3.3.0.15              BIOS Version: 1.20.3.0                      |
    |------------------------------------+---------------------+----------------------+
    | GPU         NAME                   | Bus-id              | GPU-Util             |
    | Temp        Pwr:Usage/Cap          | Memory-Usage        |                      |
    |====================================+=====================+======================|
    | 0           MetaX C500             | 0000:19:00.0        | 0%                   |
    | 54C         48W / 350W             | 858/65536 MiB       |                      |
    +------------------------------------+---------------------+----------------------+
    
    +---------------------------------------------------------------------------------+
    | Process:                                                                        |
    |  GPU                    PID         Process Name                 GPU Memory     |
    |                                                                  Usage(MiB)     |
    |=================================================================================|
    |  no process found                                                               |
    +---------------------------------------------------------------------------------+
    
    End of Log
    
  • Members 221 posts
    2026年1月23日 10:51

    尊敬的开发者您好,请联系接口人请求技术支持。

  • arrow_forward

    Thread has been moved from 解决中.