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

[ GPU ] Update android_test.sh to enable unittests for GPU @open sesame 11/04 09:08 #2773

Merged
merged 2 commits into from
Nov 15, 2024

Conversation

EunjuYang
Copy link
Contributor

@EunjuYang EunjuYang commented Oct 25, 2024

  • This commit updates android_test.sh to enable unittests for GPU
    • create nntrainer_opencl_kernels folder
    • add some command lines to push nngolden data to android
  • unittest_layers.tar.gz is updated to add nnlayer golden data for GPU layers.
  • This commit updates how-to-use-testcases.md file, including guide for running test cases for OpenCL on Android.

Note

Self evaluation:

  1. Build test: [X]Passed [ ]Failed [ ]Skipped
  2. Run test: [X]Passed [ ]Failed [ ]Skipped

@taos-ci
Copy link

taos-ci commented Oct 25, 2024

📝 TAOS-CI Version: 1.5.20200925. Thank you for submitting PR #2773. Please a submit 1commit/1PR (one commit per one PR) policy to get comments quickly from reviewers. Your PR must pass all verificiation processes of cibot before starting a review process from reviewers. If you are new member to join this project, please read manuals in documentation folder and wiki page. In order to monitor a progress status of your PR in more detail, visit http://ci.nnstreamer.ai/.

@EunjuYang EunjuYang marked this pull request as ready for review October 25, 2024 03:30
@taos-ci
Copy link

taos-ci commented Oct 25, 2024

:octocat: cibot: @EunjuYang, The last line of a text file must have a newline character. Please append a new line at the end of the line in docs/how-to-use-testcases.md.

Copy link

@taos-ci taos-ci left a comment

Choose a reason for hiding this comment

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

@EunjuYang, 💯 All CI checkers are successfully verified. Thanks.

@EunjuYang EunjuYang force-pushed the gpu_unittest_setting branch from 48ca2f9 to f8d520f Compare October 25, 2024 04:17
@@ -458,7 +458,6 @@ LOCAL_SRC_FILES := \
../unittest/layers/unittest_layers_flatten.cpp \
../unittest/layers/unittest_layers_activation.cpp \
../unittest/layers/unittest_layers_addition.cpp \
../unittest/layers/unittest_layers_addition_cl.cpp \
Copy link
Member

Choose a reason for hiding this comment

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

Question) is there any reason to remove this from unittest_layers build ?

Copy link
Contributor Author

@EunjuYang EunjuYang Oct 25, 2024

Choose a reason for hiding this comment

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

This ../unittest/layers/unittest_layers_addition_cl.cpp should be added after #2752.
If not, NDK build returns error, for the addition layer for OpenCL is not implemented in the current upstream. I wanted to make upstream run as it is.
By the way... it would be better to change this PR [Wait for #2752], while removing this change.

Copy link
Member

@DonghakPark DonghakPark Oct 25, 2024

Choose a reason for hiding this comment

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

i see, thank you for detail explain

By the way... it would be better to change this PR [Wait for https://github.com//pull/2752], while removing this change.

Yes i would be good!! or i think you can simply rebase #2752 or cherry pick some commit's ( if there are some dependency)

rebase sample command
git pull --rebase upstream refs/pull/2752/head:

Copy link
Contributor Author

@EunjuYang EunjuYang Oct 25, 2024

Choose a reason for hiding this comment

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

Sounds good! I will rebase #2752. Thank you ☺

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DonghakPark
I tested rebasing on #2752, but the PR itself is not well rebased on the main; It makes this PR jammed.
Instead of rebasing on it, I updated the Android.mk to leave line you mentioned as commented out. Could you please check the update?
If #2752 is merged or it resolves the rebasing issue, I will update this PR as well.

Copy link
Member

Choose a reason for hiding this comment

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

If so, it seems to be good. It may reduce inconvenience

Copy link

@taos-ci taos-ci left a comment

Choose a reason for hiding this comment

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

@EunjuYang, 💯 All CI checkers are successfully verified. Thanks.

@EunjuYang EunjuYang force-pushed the gpu_unittest_setting branch from f8d520f to 7bcc1f4 Compare October 25, 2024 06:54
@EunjuYang EunjuYang changed the title [ GPU ] Update android_test.sh to enable unittests for GPU [Wait for #2752] [ GPU ] Update android_test.sh to enable unittests for GPU Oct 25, 2024
@EunjuYang EunjuYang force-pushed the gpu_unittest_setting branch from 7bcc1f4 to e00d205 Compare October 25, 2024 07:09
@EunjuYang EunjuYang changed the title [Wait for #2752] [ GPU ] Update android_test.sh to enable unittests for GPU [ GPU ] Update android_test.sh to enable unittests for GPU Oct 25, 2024
Copy link

@taos-ci taos-ci left a comment

Choose a reason for hiding this comment

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

@EunjuYang, 💯 All CI checkers are successfully verified. Thanks.

# $ adb push res/ /data/local/tmp/nntr_android_test
# meson build will unzip golden data for the unit tests
cd ../../../
meson build
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be nice to add some basic flags to get the proper golden data (e.g., -Denable-fp16=true, -Denable-neon=true, -Denable-opencl=true)

Copy link
Member

Choose a reason for hiding this comment

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

Good point!! for more information we use below flags for build android_package

-Dplatform=android 
-Dopenblas-num-threads=1 
-Denable-tflite-interpreter=false 
-Denable-tflite-backbone=false 
-Denable-fp16=true 
-Denable-neon=true 
-Domp-num-threads=1 
-Denable-opencl=true 
-Dhgemm-experimental-kernel=false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the comments, all! It would be better to apply the same options for the android build. I will apply it 😀

Copy link
Contributor Author

@EunjuYang EunjuYang Oct 29, 2024

Choose a reason for hiding this comment

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

@DonghakPark I applied every option you suggested except for the android option, formeson.build doesn't create resource for unittest with -Dplatofrm=android option

Please refer to

warning('test is not supported in android build, test skipped')

Copy link
Member

Choose a reason for hiding this comment

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

Thank you for considering my opinion.
I think we need to ensure that testing is enabled in the future, even for cases of Android as well. (As there are increasingly more examples utilizing Android.)
I will create an issue for this matter.

@baek2sm
Copy link
Contributor

baek2sm commented Oct 28, 2024

Don't we need a script to make golden data as well?

@EunjuYang
Copy link
Contributor Author

Don't we need a script to make golden data as well?

Thank you for your comment. The script for the golden data was already updated in gen_lsyer_tests.py in previous PRs. However, they were tested by creating the golden data manually and pushing them to test environment.
To make it easier and a common test tool, this PR updates unittest_layers.tar.gz and android_test.sh. If I missed some steps, please let me know.

FYI, I attach some links for the golden layer generation parts additionally added in this update :

class RMSNorm(tf.keras.layers.Layer):

def reshape_tensor(tensor, batch_size, input_channel, input_height, input_width):

def swiglu(inputs):

@EunjuYang EunjuYang force-pushed the gpu_unittest_setting branch from e00d205 to 84c9ca9 Compare October 29, 2024 01:08
Copy link

@taos-ci taos-ci left a comment

Choose a reason for hiding this comment

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

@EunjuYang, 💯 All CI checkers are successfully verified. Thanks.

Copy link
Contributor

@baek2sm baek2sm left a comment

Choose a reason for hiding this comment

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

LGTM

# $ adb push res/ /data/local/tmp/nntr_android_test
# meson build will unzip golden data for the unit tests
cd ../../../
meson build -Dopenblas-num-threads=1 \
Copy link
Contributor

Choose a reason for hiding this comment

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

there might be cases where the build directory already exists. we should handle that case!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great point! I will update the script. Thanks!

- This commit updates android_test.sh to enable unittests for GPU
- This commit updates `how-to-use-testcases.md` file, including guide
for running test cases for OpenCL on Android.
- This commit remove add kernel from Android.mk in order to make it
enabled (commented out)
- unittest_layers.tar.gz is updated to add nnlayer golden data  for GPU layers.

**Self evaluation**:

1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: Eunju Yang <[email protected]>
@EunjuYang EunjuYang force-pushed the gpu_unittest_setting branch from 84c9ca9 to 71f3a4a Compare November 1, 2024 03:26
Copy link

@taos-ci taos-ci left a comment

Choose a reason for hiding this comment

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

@EunjuYang, 💯 All CI checkers are successfully verified. Thanks.

@jijoongmoon jijoongmoon changed the title [ GPU ] Update android_test.sh to enable unittests for GPU [ GPU ] Update android_test.sh to enable unittests for GPU @open sesame 11/04 09:08 Nov 4, 2024
- This commit is related to nnstreamer#2774.
- The test `setPropertiesInvalid_n_gpu` was failed with
LayerPropertySemantics, which tests negative case for some layers not
implemented for GPU.
- This test should be enabled later.

Self evaluation:

Build test: [X]Passed [ ]Failed [ ]Skipped
Run test: [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: Eunju Yang <[email protected]>
@EunjuYang EunjuYang force-pushed the gpu_unittest_setting branch from 71f3a4a to fd95c4f Compare November 4, 2024 00:18
Copy link

@taos-ci taos-ci left a comment

Choose a reason for hiding this comment

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

@EunjuYang, 💯 All CI checkers are successfully verified. Thanks.

Copy link
Contributor

@djeong20 djeong20 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@skykongkong8 skykongkong8 left a comment

Choose a reason for hiding this comment

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

This resolves many inconveniences that I have been working on. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants