During operator compilation, you need to be aware of different architectures and AI processor models.
...
target_compile_options(demo PRIVATE
// Replace xxxx in dav-xxxx with the corresponding NPU architecture version.
$<$<COMPILE_LANGUAGE:ASC>:--npu-arch=dav-xxxx>
)
1 2 | void AddConfig(const char *soc); void AddConfig(const char *soc, OpAICoreConfig &aicore_config); |
The following is an example of registering the AI processor model through this API. For details about how to set ascendxxx, see the ASCEND_COMPUTE_UNIT field in the compilation configuration file CMakePresets.json in the operator project directory. The value of this field is automatically generated when msOpGen is used to create the project.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ... namespace ops { class AddCustom : public OpDef { public: AddCustom(const char* name) : OpDef(name) { ... // Replace ascendXXX with the corresponding chip version. this->AICore().AddConfig("ascendxxx"); } }; OP_ADD(AddCustom); } // namespace ops |