← Back to Pull requests

[mlir] Add guard for using posixmemalign <= Android API 28 #194263

Open
trcrsired opened this pull request with 7 lines diff across 1 files
View on GitHub
trcrsired trcrsired commented on Apr 26, 2026 20:03 UTC
Author

aligned_alloc does not exist for Android before 28 too just like apple

Diff: 7 lines (+4 / -3) across 1 files Reviewer: enh-google Review duration: 319153m
All Vouch review confidence checks passed
Residual risk 0.05 = Change Risk (0.22) × (1 − Review Confidence (0.78)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.22 · 7 lines diff across 1 files
0.22
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.68 · 5 substantive comment(s)
0.68
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
77%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.124
Real PR Conversation Timeline
8 items
llvmbot llvmbot commented on Apr 26, 2026 20:03 UTC
Contributor

<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-execution-engine

Author: cqwrteur (trcrsired)

<details>
<summary>Changes</summary>

aligned_alloc does not exist for Android before 28 too just like apple

---
Full diff: https://github.com/llvm/llvm-project/pull/194263.diff

1 Files Affected:

  • (modified) mlir/lib/ExecutionEngine/CRunnerUtils.cpp (+1-1)
  • ``````

    diff --git a/mlir/lib/ExecutionEngine/CRunnerUtils.cpp b/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
    index 41c619566b55d..272137d4b1d7c 100644
    --- a/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
    +++ b/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
    @@ -152,7 +152,7 @@ extern "C" void *mlirAlloc(uint64_t size) { return malloc(size); }
     extern "C" void *mlirAlignedAlloc(uint64_t alignment, uint64_t size) {
     #ifdef _WIN32
       return _aligned_malloc(size, alignment);
    -#elif defined(__APPLE__)
    +#elif defined(__APPLE__) || (defined(__ANDROID_API__) && __ANDROID_API__ <= 28)
       // aligned_alloc was added in MacOS 10.15. Fall back to posix_memalign to also
       // support older versions.
       void *result = nullptr;
    
    
    ``````

    </details>

    enh-google enh-google commented on code on May 04, 2026 17:23 UTC
    Code Review
    mlir/lib/ExecutionEngine/CRunnerUtils.cpp:1
    @@ -152,7 +152,7 @@ extern "C" void *mlirAlloc(uint64_t size) { return malloc(size); }
     extern "C" void *mlirAlignedAlloc(uint64_t alignment, uint64_t size) {
     #ifdef _WIN32
       return _aligned_malloc(size, alignment);
    -#elif defined(__APPLE__)
    +#elif defined(__APPLE__) || (defined(__ANDROID_API__) && __ANDROID_API__ <= 28)
       // aligned_alloc was added in MacOS 10.15. Fall back to posix_memalign to also

    maybe update the comment too?

    enh-google enh-google approved these changes on May 04, 2026 17:23 UTC
    Approved Reviewer

    Approved these changes.

    trcrsired trcrsired commented on code on May 04, 2026 17:59 UTC
    Code Review
    mlir/lib/ExecutionEngine/CRunnerUtils.cpp:1
    @@ -152,7 +152,7 @@ extern "C" void *mlirAlloc(uint64_t size) { return malloc(size); }
     extern "C" void *mlirAlignedAlloc(uint64_t alignment, uint64_t size) {
     #ifdef _WIN32
       return _aligned_malloc(size, alignment);
    -#elif defined(__APPLE__)
    +#elif defined(__APPLE__) || (defined(__ANDROID_API__) && __ANDROID_API__ <= 28)
       // aligned_alloc was added in MacOS 10.15. Fall back to posix_memalign to also

    ok

    trcrsired trcrsired commented on code on May 04, 2026 18:11 UTC
    Code Review
    mlir/lib/ExecutionEngine/CRunnerUtils.cpp:1
    @@ -152,7 +152,7 @@ extern "C" void *mlirAlloc(uint64_t size) { return malloc(size); }
     extern "C" void *mlirAlignedAlloc(uint64_t alignment, uint64_t size) {
     #ifdef _WIN32
       return _aligned_malloc(size, alignment);
    -#elif defined(__APPLE__)
    +#elif defined(__APPLE__) || (defined(__ANDROID_API__) && __ANDROID_API__ <= 28)
       // aligned_alloc was added in MacOS 10.15. Fall back to posix_memalign to also

    done

    enh-google enh-google approved these changes on May 04, 2026 18:16 UTC
    Approved Reviewer

    Approved these changes.

    trcrsired trcrsired commented on May 09, 2026 10:20 UTC
    Author

    when to merge? thanks

    Reviewers
    Assignees
    trcrsired trcrsired
    Labels
    risk: low confidence: 77.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 22.4% (LOW) · Higher = larger blast radius
    22.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 77.7% · Lower = rushed or shallow review
    77.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 5% · Safe to merge
    5%