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
6 changes: 3 additions & 3 deletions examples/cubin_launcher/dynamic_cubin/src/lib_dynamic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ void MulTwo(tvm::ffi::TensorView x, tvm::ffi::TensorView y) {
}

// Export TVM-FFI functions
TVM_FFI_DLL_EXPORT_TYPED_FUNC(set_cubin, cubin_dynamic::SetCubin);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one, cubin_dynamic::AddOne);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(mul_two, cubin_dynamic::MulTwo);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(set_cubin, cubin_dynamic::SetCubin)
TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one, cubin_dynamic::AddOne)
TVM_FFI_DLL_EXPORT_TYPED_FUNC(mul_two, cubin_dynamic::MulTwo)

} // namespace cubin_dynamic
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void MulTwo(tvm::ffi::TensorView x, tvm::ffi::TensorView y) {
}

// Export TVM-FFI functions
TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one, cubin_embedded::AddOne);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(mul_two, cubin_embedded::MulTwo);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one, cubin_embedded::AddOne)
TVM_FFI_DLL_EXPORT_TYPED_FUNC(mul_two, cubin_embedded::MulTwo)

} // namespace cubin_embedded
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void MulTwo(tvm::ffi::TensorView x, tvm::ffi::TensorView y) {
}

// Export TVM-FFI functions
TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one, cubin_embedded::AddOne);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(mul_two, cubin_embedded::MulTwo);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one, cubin_embedded::AddOne)
TVM_FFI_DLL_EXPORT_TYPED_FUNC(mul_two, cubin_embedded::MulTwo)

} // namespace cubin_embedded
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void MulTwo(tvm::ffi::TensorView x, tvm::ffi::TensorView y) {
}

// Export TVM-FFI functions
TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one, cubin_embedded::AddOne);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(mul_two, cubin_embedded::MulTwo);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one, cubin_embedded::AddOne)
TVM_FFI_DLL_EXPORT_TYPED_FUNC(mul_two, cubin_embedded::MulTwo)

} // namespace cubin_embedded
2 changes: 1 addition & 1 deletion examples/python_packaging/src/extension.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace ffi = tvm::ffi;
// [tvm_ffi_abi.begin]
static int AddTwo(int x) { return x + 2; }

TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_two, AddTwo);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_two, AddTwo)
// [tvm_ffi_abi.end]

// [global_function.begin]
Expand Down
2 changes: 1 addition & 1 deletion examples/quickstart/compile/add_one_cpu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ void AddOne(tvm::ffi::TensorView x, tvm::ffi::TensorView y) {
}
}

TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one_cpu, tvm_ffi_example_cpu::AddOne);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one_cpu, tvm_ffi_example_cpu::AddOne)
} // namespace tvm_ffi_example_cpu
// [example.end]
3 changes: 2 additions & 1 deletion include/tvm/ffi/reflection/overload.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ struct TypedOverload : OverloadBase {

private:
template <std::size_t I>
void GetMismatchMessageAux(std::ostringstream& os, const AnyView* args, int32_t num_args) {
void GetMismatchMessageAux(std::ostringstream& os, const AnyView* args,
[[maybe_unused]] int32_t num_args) {
Comment on lines +148 to +149
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While [[maybe_unused]] correctly suppresses the compiler warning, a cleaner solution would be to remove the num_args parameter from GetMismatchMessageAux entirely, as it is not used. This would improve code clarity by removing the unneeded parameter and would require updating its call sites.

if constexpr (I < kNumArgs) {
if (this->last_mismatch_index_ == static_cast<int32_t>(I)) {
TVMFFIAny any_data = args[I].CopyToTVMFFIAny();
Expand Down
2 changes: 1 addition & 1 deletion src/ffi/testing/testing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ TVM_FFI_STATIC_INIT_BLOCK() {
// Exported symbols for metadata testing on DLL-exported functions
// -----------------------------------------------------------------------------
// We keep minimal DLL exports here to verify the export mechanism.
TVM_FFI_DLL_EXPORT_TYPED_FUNC(testing_dll_schema_id_int, tvm::ffi::schema_test_impl::schema_id_int);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(testing_dll_schema_id_int, tvm::ffi::schema_test_impl::schema_id_int)

// Documentation export
TVM_FFI_DLL_EXPORT_TYPED_FUNC(testing_dll_test_add_with_docstring,
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/test_function.cc
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ TEST(SetRaisedFromCStrParts, TypeError) {

int testing_add1(int x) { return x + 1; }

TVM_FFI_DLL_EXPORT_TYPED_FUNC(testing_add1, testing_add1);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(testing_add1, testing_add1)

TEST(Func, FromExternC) {
// this is the function abi convention
Expand Down
12 changes: 6 additions & 6 deletions tests/python/cpp_src/test_stl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ auto test_function(std::function<int(void)> f) -> std::function<int(void)> {
return [fn = std::move(f)] { return fn() + 1; };
}

TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_tuple, test_tuple);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_vector, test_vector);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_variant, test_variant);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_map, test_map);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_map_2, test_map_2);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_function, test_function);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_tuple, test_tuple)
TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_vector, test_vector)
TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_variant, test_variant)
TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_map, test_map)
TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_map_2, test_map_2)
TVM_FFI_DLL_EXPORT_TYPED_FUNC(test_function, test_function)

} // namespace
2 changes: 1 addition & 1 deletion tests/python/test_build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ void add_one_cpu(tvm::ffi::TensorView x, tvm::ffi::TensorView y) {
}
}

TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one_cpu, add_one_cpu);
TVM_FFI_DLL_EXPORT_TYPED_FUNC(add_one_cpu, add_one_cpu)