put typedvalues initialization into cpp

Signed-off-by: Jinjie Liu <jjliu@baai.ac.cn>
This commit is contained in:
2026-01-30 01:38:58 +08:00
parent bdc9c03b75
commit a953cbe7cc
10 changed files with 92 additions and 47 deletions
+9
View File
@@ -25,6 +25,15 @@ private:
const std::string message_;
};
class UnmatchedArgumentException : public std::exception {
public:
UnmatchedArgumentException(std::string_view name, size_t len, size_t expect);
const char *what() const noexcept override;
private:
const std::string message_;
};
class UnknownTypeException : public std::exception {
public:
UnknownTypeException(Type type);
+2 -3
View File
@@ -2,8 +2,7 @@
#define TRITON_TVM_FFI_TYPE_H_
#include <cstdint>
#include <tvm/ffi/object.h>
#include <tvm/ffi/string.h>
#include <tvm/ffi/tvm_ffi.h>
#include <type_traits>
namespace triton_tvm_ffi {
@@ -35,7 +34,7 @@ enum class Type : int64_t {
};
const char *TypeToString(Type type);
tvm::ffi::Optional<Type> StringToType(tvm::ffi::String str);
tvm::ffi::Optional<Type> StringToType(const tvm::ffi::String &name);
template <Type T> struct type_to_ctype;
#define DEFINE_TYPE_TO_CTYPE(type, str, ctype) \
+7
View File
@@ -40,6 +40,13 @@ public:
TypedValueObj);
};
tvm::ffi::Optional<TypedValue> MakeTypedValue(const tvm::ffi::String &type,
const tvm::ffi::Any &value);
tvm::ffi::Array<TypedValue>
MakeTypedValues(const tvm::ffi::Array<tvm::ffi::String> &types,
const tvm::ffi::Array<tvm::ffi::Any> &values);
} // namespace triton_tvm_ffi
#endif