Skip to content

Commit

Permalink
Merge branch 'taichi-dev:master' into amdgpu_pass_ut
Browse files Browse the repository at this point in the history
  • Loading branch information
galeselee authored Jan 4, 2023
2 parents 5e34a11 + 481ded6 commit 6e1a151
Show file tree
Hide file tree
Showing 38 changed files with 133 additions and 358 deletions.
1 change: 0 additions & 1 deletion .github/workflows/scripts/android-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ python -m pip install -r requirements_dev.txt
python setup.py clean
python setup.py build_ext
cd build
aarch64-linux-android-strip libtaichi_export_core.so
aarch64-linux-android-strip libtaichi_c_api.so

chmod -R 777 "$SCCACHE_DIR"
28 changes: 12 additions & 16 deletions .github/workflows/scripts/aot-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export TAICHI_UNITY_EXAMPLE_BRANCH=main


function build-and-smoke-test-android-aot-demo {
setup-android-ndk-env

pushd taichi
GIT_COMMIT=$(git rev-parse HEAD | cut -c1-7)
setup_python
Expand All @@ -26,26 +28,20 @@ function build-and-smoke-test-android-aot-demo {

rm -rf taichi-aot-demo
# IF YOU PIN THIS TO A COMMIT/BRANCH, YOU'RE RESPONSIBLE TO REVERT IT BACK TO MASTER ONCE MERGED.
git clone --depth=1 -b "$TAICHI_AOT_DEMO_BRANCH" "$TAICHI_AOT_DEMO_URL"

APP_ROOT=taichi-aot-demo/implicit_fem
ANDROID_APP_ROOT=$APP_ROOT/android
JNI_PATH=$ANDROID_APP_ROOT/app/src/main/jniLibs/arm64-v8a/
git clone --recursive --depth=1 -b "$TAICHI_AOT_DEMO_BRANCH" "$TAICHI_AOT_DEMO_URL"

# Install taichi-python
pip install /taichi-wheel/*.whl
pushd $APP_ROOT/python
sudo chmod 0777 $HOME/.cache
python implicit_fem.py --aot
popd
mkdir -p $JNI_PATH
cp taichi/build/libtaichi_export_core.so $JNI_PATH
cd $ANDROID_APP_ROOT
sed -i "s/TaichiAOT/AOT-$GIT_COMMIT/g" app/src/main/res/values/strings.xml
./gradlew build

# Build Android Apps
cd taichi-aot-demo
./scripts/build-taichi-android.sh
./scripts/build-android.sh
./scripts/build-android-app.sh E3_implicit_fem

run-android-app \
app/build/outputs/apk/debug/app-debug.apk \
com.taichigraphics.aot_demos.implicit_fem/android.app.NativeActivity
framework/android/app/build/outputs/apk/debug/E3_implicit_fem-debug.apk \
org.taichi.aot_demo/android.app.NativeActivity
}

function prepare-unity-build-env {
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/scripts/unix_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ else
run-it cpu $(nproc)
run-it vulkan 8
run-it opengl 4
run-it gles 4

python3 tests/run_tests.py -vr2 -t1 -k "torch" -a "$TI_WANTED_ARCHS"
# Paddle's paddle.fluid.core.Tensor._ptr() is only available on develop branch, and CUDA version on linux will get error `Illegal Instruction`
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ jobs:
/home/dev/taichi/.github/workflows/scripts/unix_test.sh
env:
PY: '3.8'
TI_WANTED_ARCHS: 'cc,cpu,cuda,vulkan,opengl,gles'
TI_WANTED_ARCHS: 'cc,cpu,cuda,vulkan,opengl'
TI_DEVICE_MEMORY_GB: '1'
TI_RUN_RELEASE_TESTS: '1'

Expand Down Expand Up @@ -344,7 +344,7 @@ jobs:
include:
- os: windows-2019
llvmVer : '15'
archs: "cpu,cuda,opengl,gles"
archs: "cpu,cuda,opengl"
runsOn: [self-hosted, windows, cuda, OpenGL]
runs-on: ${{ matrix.runsOn }}
timeout-minutes: ${{ github.event.schedule != '0 18 * * *' && 90 || 180 }}
Expand Down Expand Up @@ -537,7 +537,7 @@ jobs:
-DTI_WITH_LLVM:BOOL=OFF
-DTI_WITH_C_API=ON
- name: Test For Android AOT (export core)
- name: Test For Android AOT
if: ${{ needs.check_files.outputs.run_job != 'false' }}
run: |
. .github/workflows/scripts/common-utils.sh
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ repos:
additional_dependencies: [toml]

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.11.4
hooks:
- id: isort

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v13.0.1
rev: v15.0.6
hooks:
- id: clang-format
exclude: .*\.json$

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer

- repo: https://github.com/PyCQA/pylint
rev: v2.13.4
rev: v2.15.9
hooks:
- id: pylint
args: ['-rn', '-sn']
Expand Down
10 changes: 0 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,6 @@ endif()
configure_file(taichi/common/version.h.in ${CMAKE_SOURCE_DIR}/taichi/common/version.h)
configure_file(taichi/common/commit_hash.h.in ${CMAKE_SOURCE_DIR}/taichi/common/commit_hash.h)

option(TI_EXPORT_CORE "export taichi core" OFF)

if(ANDROID)
set(TI_EXPORT_CORE ON)
endif()

if (TI_EXPORT_CORE)
include(cmake/TaichiExportCore.cmake)
endif()

option(TI_WITH_C_API "build taichi runtime c-api library" OFF)

if (TI_WITH_C_API)
Expand Down
15 changes: 0 additions & 15 deletions c_api/include/taichi/taichi_opengl.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,6 @@
extern "C" {
#endif // __cplusplus

// Structure `TiOpenglRuntimeInteropInfo`
typedef struct TiOpenglRuntimeInteropInfo {
void *get_proc_addr;
} TiOpenglRuntimeInteropInfo;

// Function `ti_import_opengl_runtime`
TI_DLL_EXPORT void TI_API_CALL
ti_import_opengl_runtime(TiRuntime runtime,
TiOpenglRuntimeInteropInfo *interop_info);

// Function `ti_export_opengl_runtime`
TI_DLL_EXPORT void TI_API_CALL
ti_export_opengl_runtime(TiRuntime runtime,
TiOpenglRuntimeInteropInfo *interop_info);

// Structure `TiOpenglMemoryInteropInfo`
typedef struct TiOpenglMemoryInteropInfo {
GLuint buffer;
Expand Down
9 changes: 0 additions & 9 deletions c_api/src/taichi_opengl_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

OpenglRuntime::OpenglRuntime()
: GfxRuntime(taichi::Arch::opengl),
device_(),
gfx_runtime_(taichi::lang::gfx::GfxRuntime::Params{
host_result_buffer_.data(), &device_}) {
taichi::lang::DeviceCapabilityConfig caps{};
Expand All @@ -19,14 +18,6 @@ taichi::lang::gfx::GfxRuntime &OpenglRuntime::get_gfx_runtime() {
return gfx_runtime_;
}

void ti_export_opengl_runtime(TiRuntime runtime,
TiOpenglRuntimeInteropInfo *interop_info) {
TI_CAPI_TRY_CATCH_BEGIN();
// FIXME: (penguinliogn)
interop_info->get_proc_addr = taichi::lang::opengl::kGetOpenglProcAddr;
TI_CAPI_TRY_CATCH_END();
}

void ti_export_opengl_memory(TiRuntime runtime,
TiMemory memory,
TiOpenglMemoryInteropInfo *interop_info) {
Expand Down
2 changes: 0 additions & 2 deletions c_api/src/taichi_vulkan_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ VulkanRuntimeImported::Workaround::Workaround(
taichi::lang::vulkan::VulkanLoader::instance().load_instance(params.instance);
taichi::lang::vulkan::VulkanLoader::instance().load_device(params.device);
vk_device.vk_caps().vk_api_version = api_version;
// FIXME: (penguinliong) Workaround missing vulkan caps from import.
vk_device.vk_caps().external_memory = true;

taichi::lang::DeviceCapabilityConfig caps{};

Expand Down
38 changes: 0 additions & 38 deletions c_api/taichi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1248,44 +1248,6 @@
"taichi/taichi_core.h"
],
"declarations": [
{
"name": "opengl_runtime_interop_info",
"type": "structure",
"fields": [
{
"name": "get_proc_addr",
"type": "void*"
}
]
},
{
"name": "import_opengl_runtime",
"type": "function",
"parameters": [
{
"type": "handle.runtime"
},
{
"name": "interop_info",
"type": "structure.opengl_runtime_interop_info",
"by_mut": true
}
]
},
{
"name": "export_opengl_runtime",
"type": "function",
"parameters": [
{
"type": "handle.runtime"
},
{
"name": "interop_info",
"type": "structure.opengl_runtime_interop_info",
"by_mut": true
}
]
},
{
"name": "opengl_memory_interop_info",
"type": "structure",
Expand Down
3 changes: 0 additions & 3 deletions cmake/TaichiCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ set(INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/python/taichi/_lib)

if(ANDROID)
set(TI_WITH_VULKAN ON)
set(TI_EXPORT_CORE ON)
set(TI_WITH_LLVM OFF)
set(TI_WITH_METAL OFF)
set(TI_WITH_CUDA OFF)
Expand Down Expand Up @@ -435,8 +434,6 @@ target_link_libraries(taichi_ui PUBLIC ${CORE_LIBRARY_NAME})
if(TI_WITH_PYTHON)
message("PYTHON_LIBRARIES: " ${PYTHON_LIBRARIES})
set(CORE_WITH_PYBIND_LIBRARY_NAME taichi_python)
# Cannot compile Python source code with Android, but TI_EXPORT_CORE should be set and
# Android should only use the isolated library ignoring those source code.
if (NOT ANDROID)
# NO_EXTRAS is required here to avoid llvm symbol error during build
file(GLOB TAICHI_PYBIND_SOURCE
Expand Down
101 changes: 0 additions & 101 deletions cmake/TaichiExportCore.cmake

This file was deleted.

5 changes: 0 additions & 5 deletions cmake/taichi_export_coreConfig.cmake.in

This file was deleted.

6 changes: 1 addition & 5 deletions docs/lang/articles/reference/global_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ Following are some frequently-used configurations in `ti.init()`:
offline_cache_file_path: str
Set a directory for holding the offline cached files.
packed: bool
Enable/disable the packed memory layout.
random_seed: int
Set a custom seed for the random number generator.
Expand Down Expand Up @@ -174,15 +171,14 @@ If you want to use CUDA and Taichi's GGUI system at the same time on a machine w
- To set a custom seed for the random number generator used by `ti.random()`: `ti.init(random_seed=seed)`. `seed` should be an integer. An example: `ti.init(random_seed=int(time.time()))`.
- To set the default precision of floating-point numbers of Taichi runtime to `ti.f64`: `ti.init(default_fp=ti.i64)`.
- To set the default precision of floating-point numbers of Taichi runtime to `ti.i32`: `ti.init(default_ip=ti.i32)`.
- To enable the packed mode for memory layout: `ti.init(packed=True)`. See the [Packed mode](../basic/layout.md#packed-mode) for more information.
- To disable the offline cache of compiled kernels: `ti.init(offline_cache=False)`. See the [Offline cache](../performance_tuning/performance.md#offline-cache) for more information.
- To enable the use of variables as indices to access vector/matrix elements in the Taichi scope: `ti.init(dynamic_index=True)`.
- To turn on kernel profiling: `ti.init(kernel_profiler=True)`. See the [Profiler](../performance_tuning/profiler.md#kernelprofiler) for more information.


## Logging

- To set the logging level: `ti.init(log_level=ti.TRACE)` or `ti.set_logging_level(ti.TRACE)` enables the TRACE level. The environment variable `TI_LOG_LEVEL` serves the same purpose.
- To set the logging level: `ti.init(log_level=ti.TRACE)` or `ti.set_logging_level(ti.TRACE)` enables the TRACE level. The environment variable `TI_LOG_LEVEL` serves the same purpose.
- To eliminate verbose outputs: `ti.init(verbose=False)`.

## Develop
Expand Down
4 changes: 2 additions & 2 deletions misc/baselines/bandwidth.cu
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ __global__ void fd(float *a, float *b, int *c, int n) {
// i = (i * 1e-10f);
// i = i * i * i * i * i % m;
// b_s[i % m] = 1;
//#define C(x) i += (i >> x);
//#define C(x) i += (i >> x);
// #define C(x) i += (i >> x);
// #define C(x) i += (i >> x);
// for (int t = 0; t < 240; t++)
// C(30);
i += int(sin(i * 1e-20f));
Expand Down
Loading

0 comments on commit 6e1a151

Please sign in to comment.