-
Notifications
You must be signed in to change notification settings - Fork 116
Add Android 16KB page size support for ONNX Runtime Extensions #1007
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
Open
ssk18
wants to merge
18
commits into
microsoft:main
Choose a base branch
from
ssk18:enable-16KB-for-android
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
1568b7f
Add Android 16KB page size support for ONNX Runtime Extensions
ssk18 280ffab
Adds ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES CMake option (default: ON) to
ssk18 88a80d2
Add documentation and CI for Android 16KB page size support
ssk18 8e8698d
Remove redundant target_link_options for 16KB page size
ssk18 addf59e
Merge branch 'main' into enable-16KB-for-android
ssk18 d21e703
Remove branch-specific push trigger from Android 16KB workflow
ssk18 51b1a75
Removed ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES option, always enable 16K…
ssk18 cf22e8f
added add_link_options() for 16KB page size flag
ssk18 51c9a1e
Updated Readme file
ssk18 10b411a
Updated workflow and verification script to remove obsolete option re…
ssk18 f378a3a
Updated NDK requirement comment to avoid version-specific references …
ssk18 73dd655
Updated JDK to 17
ssk18 5253244
Apply suggestion from @edgchen1
ssk18 413fa53
Added missing unordered_map include in tokenizer_common.h
ssk18 ef29598
Merge remote-tracking branch 'origin/enable-16KB-for-android' into en…
ssk18 41a1f98
Added workflow to only verify libortextensions and libonnxruntime_ex…
ssk18 b665df4
Merge branch 'main' into enable-16KB-for-android
ssk18 9b31d4d
Merge branch 'main' into enable-16KB-for-android
edgchen1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| name: Android 16KB Page Size Verification | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'CMakeLists.txt' | ||
| - 'cmake/**' | ||
| - 'java/**' | ||
| - 'tools/build.py' | ||
| - '.github/workflows/android-16kb-check.yml' | ||
|
|
||
| jobs: | ||
| verify-android-16kb-alignment: | ||
| name: Build & Verify 16KB Page Alignment (arm64-v8a) | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.10' | ||
|
|
||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '17' | ||
|
|
||
| - name: Setup Android NDK | ||
| uses: nttld/setup-ndk@v1 | ||
| id: setup-ndk | ||
| with: | ||
| ndk-version: r25c | ||
| add-to-path: false | ||
|
|
||
| - name: Set up Android SDK | ||
| uses: android-actions/setup-android@v3 | ||
|
|
||
| - name: Build Android arm64-v8a with 16KB support | ||
| env: | ||
| ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | ||
| run: | | ||
| set -e | ||
|
|
||
| # Use the project's build script | ||
| python tools/build.py \ | ||
| --android \ | ||
| --android_abi=arm64-v8a \ | ||
| --android_api=27 \ | ||
| --android_home=$ANDROID_HOME \ | ||
| --android_ndk_path=$ANDROID_NDK_HOME \ | ||
| --config=Release \ | ||
ssk18 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| --parallel \ | ||
| --build | ||
|
|
||
| - name: Verify 16KB page alignment | ||
| env: | ||
| ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | ||
| run: | | ||
| set -e | ||
|
|
||
| echo "=== Verifying 16KB page size alignment ===" | ||
|
|
||
| # Find built libraries | ||
| LIBS=$(find build/Android -name "*.so" -type f) | ||
|
|
||
| if [ -z "$LIBS" ]; then | ||
| echo "ERROR: No .so files found in build output" | ||
| find build -type f -name "*.so" || true | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Use llvm-readelf from NDK | ||
| READELF="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-readelf" | ||
|
|
||
| if [ ! -f "$READELF" ]; then | ||
| echo "ERROR: llvm-readelf not found at $READELF" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Found libraries:" | ||
| echo "$LIBS" | ||
| echo "" | ||
|
|
||
| FAILED=0 | ||
| for LIB in $LIBS; do | ||
| echo "Checking: $(basename $LIB)" | ||
| echo "Full path: $LIB" | ||
|
|
||
| # Display LOAD segments | ||
| $READELF -l "$LIB" | grep -A 1 "LOAD" || true | ||
|
|
||
| # Check for 16KB alignment (0x4000) | ||
| if $READELF -l "$LIB" | grep -q "0x4000"; then | ||
| echo "PASS: Found 16KB alignment (0x4000) in $(basename $LIB)" | ||
| else | ||
| echo "FAIL: Did not find 16KB alignment (0x4000) in $(basename $LIB)" | ||
| echo "Full segment details:" | ||
| $READELF -l "$LIB" | ||
| FAILED=1 | ||
| fi | ||
| echo "---" | ||
| done | ||
|
|
||
| if [ $FAILED -ne 0 ]; then | ||
| echo "" | ||
| echo "ERROR: One or more libraries do not have 16KB page alignment" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "" | ||
| echo "SUCCESS: All libraries have correct 16KB page alignment" | ||
|
|
||
| - name: Upload build artifacts | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: android-arm64-libraries | ||
| path: build/Android/**/lib/*.so | ||
| retention-days: 7 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sayanshaw24 is it ok to add a new workflow for this check? or would it be preferable to add it to the existing CI build pipeline?