Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[aot] Import CPU and CUDA memory for Taichi AOT #8368

Closed
wants to merge 10 commits into from
Closed

[aot] Import CPU and CUDA memory for Taichi AOT #8368

wants to merge 10 commits into from

Conversation

Routhleck
Copy link
Contributor

@Routhleck Routhleck commented Oct 14, 2023

Issue: #

Brief Summary

🤖 Generated by Copilot at 1b3f2f9

This pull request adds new C API functions to import host or device memory pointers into TiMemory objects, which can be used by the Taichi runtime. It also adds helper functions and test cases for the new functions. The files taichi_cpu.h, taichi_cuda.h, taichi_llvm_impl.cpp, c_api_test_utils.h, c_api_test_utils.cpp, c_api_behavior_test.cpp, and c_api_interop_test.cpp are modified or created.

Walkthrough

🤖 Generated by Copilot at 1b3f2f9

  • Add new functions ti_import_cpu_memory and ti_import_cuda_memory to the C API for importing host or device memory pointers into TiMemory objects (link, link, link)
  • Implement helper functions cudaMalloc and cudaMemcpy for allocating and copying device memory in the C API test utils (link, link)
  • Add test cases for the new import functions in c_api_interop_test.cpp, using cudaMalloc and cudaMemcpy for the CUDA case, and verifying the data values with TiNdArray objects (link)
  • Include the CPU and CUDA header files in c_api_behavior_test.cpp to enable testing the new functions (link)

@jim19930609

@netlify
Copy link

netlify bot commented Oct 14, 2023

Deploy Preview for docsite-preview canceled.

Name Link
🔨 Latest commit a154df2
🔍 Latest deploy log https://app.netlify.com/sites/docsite-preview/deploys/652d1c1027c0d90008ca7ad0

@CLAassistant
Copy link

CLAassistant commented Oct 14, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@jim19930609 jim19930609 left a comment

Choose a reason for hiding this comment

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

Is this file tests/python/test_ipython.ipynb mistakenly added?

@Routhleck
Copy link
Contributor Author

Routhleck commented Oct 16, 2023

Yes, I removed tests/python/test_ipython.ipynb and modified other files according to comments. However, I find that there's some errors like that

/home/dev/taichi/c_api/tests/c_api_interop_test.cpp:116:28: error: too many arguments provided to function-like macro invocation
  EXPECT_TRUE(data_out[0], 1.0);
                           ^

Whether EXPECT_TRUE should not be used this way

@Routhleck Routhleck requested a review from jim19930609 October 16, 2023 03:35
@jim19930609
Copy link
Contributor

Yes, I removed tests/python/test_ipython.ipynb and modified other files according to comments. However, I find that there's some errors like that

/home/dev/taichi/c_api/tests/c_api_interop_test.cpp:116:28: error: too many arguments provided to function-like macro invocation
  EXPECT_TRUE(data_out[0], 1.0);
                           ^

Whether EXPECT_TRUE should not be used this way

Sorry, should have been EXPECT_EQ

@Routhleck
Copy link
Contributor Author

Yes, I removed tests/python/test_ipython.ipynb and modified other files according to comments. However, I find that there's some errors like that

/home/dev/taichi/c_api/tests/c_api_interop_test.cpp:116:28: error: too many arguments provided to function-like macro invocation
  EXPECT_TRUE(data_out[0], 1.0);
                           ^

Whether EXPECT_TRUE should not be used this way

Sorry, should have been EXPECT_EQ

Ok, I have replaced EXPECT_TRUE to EXPECT_EQ. And I think the file tests/python/test_ipython.ipynb was modified by the pre-commit-ci, even if I changed back to the way it was, the pre-commit-ci will still change it

@jim19930609
Copy link
Contributor

Yes, I removed tests/python/test_ipython.ipynb and modified other files according to comments. However, I find that there's some errors like that

/home/dev/taichi/c_api/tests/c_api_interop_test.cpp:116:28: error: too many arguments provided to function-like macro invocation
  EXPECT_TRUE(data_out[0], 1.0);
                           ^

Whether EXPECT_TRUE should not be used this way

Sorry, should have been EXPECT_EQ

Ok, I have replaced EXPECT_TRUE to EXPECT_EQ. And I think the file tests/python/test_ipython.ipynb was modified by the pre-commit-ci, even if I changed back to the way it was, the pre-commit-ci will still change it

hmmm the easiest way is to recreate a PR without the change in test_ipython.ipynb

@Routhleck
Copy link
Contributor Author

Ok

@Routhleck Routhleck closed this Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants