Skip to content

(fix): USE_POOLING=false path fixes and 2-tier toggle rename#24

Merged
mgyoo86 merged 7 commits intomasterfrom
fix/USE_POOLING=false
Mar 7, 2026
Merged

(fix): USE_POOLING=false path fixes and 2-tier toggle rename#24
mgyoo86 merged 7 commits intomasterfrom
fix/USE_POOLING=false

Conversation

@mgyoo86
Copy link
Member

@mgyoo86 mgyoo86 commented Mar 7, 2026

Summary

Fix bugs in the USE_POOLING=false code path and clarify the 2-tier pooling toggle naming.

Changes

Bug fixes

  • Make DisabledPool <: AbstractArrayPool — fixes type checks failing under USE_POOLING=false
  • Add missing reshape! fallback for DisabledPool{:cuda}
  • Fix @maybe_with_pool :backend function form ignoring MAYBE_POOLING_ENABLED[]

Refactor: 2-tier pooling toggle rename

  • USE_POOLINGSTATIC_POOLING (compile-time const, master switch)
  • MAYBE_POOLING_ENABLEDMAYBE_POOLING (runtime Ref{Bool}, @maybe_with_pool only)
  • Old names kept as simple const aliases for backward compatibility
  • LocalPreferences.toml key use_pooling unchanged

Tests

  • Significantly expanded USE_POOLING=false separate-process tests (290+ lines)
  • Added @maybe_with_pool :backend macro expansion tests
  • Added CUDA DisabledPool tests

Breaking changes

None — existing code using USE_POOLING and MAYBE_POOLING_ENABLED continues to work.

mgyoo86 added 4 commits March 6, 2026 23:29
…alse tests

- DisabledPool{Backend} now subtypes AbstractArrayPool, so functions
  typed as `pool::AbstractArrayPool` accept DisabledPool when pooling
  is disabled. Previously, passing a DisabledPool to typed sub-functions
  would error.

- Remove generic DisabledPool{B} fallbacks with `args...` that caused
  method ambiguity with AbstractArrayPool methods (14 Aqua violations).

- Remove dead _impl! delegators for DisabledPool — macros always use
  the original expr (with public acquire!) in the disabled branch,
  never the transformed _acquire_impl! path.

- Rewrite test_disabled_pooling.jl with 9 comprehensive test scenarios:
  type hierarchy, sub-function passing with ::AbstractArrayPool type
  annotations, all convenience functions, Bit type, state no-ops,
  function-def mode, and multi-dimensional arrays.
…ests

- Add reshape! methods for DisabledPool{:cuda} (parity with CPU)
- Add sub-function passing tests (untyped, ::AbstractArrayPool, nested)
- Add state management no-ops test (checkpoint!, rewind!, reset!, empty!)
- Add reshape! dispatch test for disabled CUDA pool
…NG_ENABLED[]

_generate_function_pool_code_with_backend was missing force_enable parameter,
causing @maybe_with_pool :backend function definitions to always use the real
pool — ignoring the runtime toggle entirely.

- Add force_enable parameter to _generate_function_pool_code_with_backend
- Generate MAYBE_POOLING_ENABLED[] branch when force_enable=false
- Add @maybe_with_pool :backend macro expansion tests (block/function/short-form)
- Add USE_POOLING=false subprocess tests: function+helper passing, @maybe_with_pool function
- Update test_coverage.jl for new function signature
…→ MAYBE_POOLING

Clarify the 2-tier pooling toggle hierarchy:
- Tier 1: STATIC_POOLING (compile-time const, master switch)
- Tier 2: MAYBE_POOLING (runtime Ref{Bool}, @maybe_with_pool only)

Old names kept as simple const aliases for backward compatibility.
Preference key "use_pooling" in LocalPreferences.toml unchanged.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes correctness gaps in the STATIC_POOLING=false / pooling-disabled paths and clarifies the two-tier pooling toggles by renaming the compile-time and runtime switches (while keeping backward-compatible aliases).

Changes:

  • Rename toggles to STATIC_POOLING (compile-time master switch) and MAYBE_POOLING (runtime toggle for @maybe_with_pool), keeping USE_POOLING / MAYBE_POOLING_ENABLED as aliases.
  • Make DisabledPool subtype AbstractArrayPool, add missing CUDA reshape! fallback, and fix @maybe_with_pool :backend function-form runtime toggle behavior.
  • Expand and adjust tests to cover the pooling-disabled branches (including separate-process preference tests and macro-expansion checks).

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/test_task_local_pool.jl Update runtime toggle tests to use MAYBE_POOLING[].
test/test_reshape.jl Update reshape allocation tests to use MAYBE_POOLING[].
test/test_macros.jl Update macro behavior tests to use MAYBE_POOLING[].
test/test_macro_expansion.jl Update macro expansion assertions/comments for renamed runtime toggle.
test/test_disabled_pooling.jl Major expansion of separate-process STATIC_POOLING=false coverage; improved failure diagnostics.
test/test_coverage.jl Adjust coverage expectations for disabled/unknown backend behavior and updated generator signature.
test/test_bitarray.jl Update runtime toggle references and remove tests tied to removed generic DisabledPool error paths.
test/test_backend_macro_expansion.jl Add macroexpansion tests for @maybe_with_pool :backend runtime toggle checks.
test/cuda/test_disabled_pool.jl Add CUDA disabled-pool tests for reshape!, sub-function passing, and no-op state ops.
src/types.jl DisabledPool{Backend} <: AbstractArrayPool and updated docs to new toggle names.
src/task_local_pool.jl Introduce STATIC_POOLING/MAYBE_POOLING and keep deprecated aliases.
src/macros.jl Fix USE_POOLING=falseSTATIC_POOLING=false gating and ensure backend function-form honors runtime toggle.
src/legacy/types.jl Make legacy DisabledPool subtype AbstractArrayPool.
src/legacy/acquire.jl Remove generic DisabledPool fallbacks/delegators that no longer apply with new macro codegen.
src/convenience.jl Remove generic DisabledPool fallbacks/delegators (consistent with new codegen paths).
src/acquire.jl Remove generic DisabledPool fallbacks/delegators (consistent with new codegen paths).
src/AdaptiveArrayPools.jl Export new toggle names and keep deprecated exports for compatibility.
ext/AdaptiveArrayPoolsCUDAExt/convenience.jl Add reshape! overloads for DisabledPool{:cuda} and update docs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ompat

- Add _record_type_touch!(::DisabledPool, ::Type) = nothing to both
  acquire.jl and legacy/acquire.jl (DisabledPool has no state to track)
- Replace FieldError with Exception in test_coverage.jl (FieldError is
  Julia 1.11+, Julia 1.10 throws ErrorException for missing fields)
- Fix @maybe_with_pool docstring: disabled pool is DisabledPool, not nothing
- Fix subprocess stderr capture in test_disabled_pooling.jl: capture
  stdout/stderr via IOBuffer in single run instead of re-executing
@codecov
Copy link

codecov bot commented Mar 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.92%. Comparing base (e9013a7) to head (39b1167).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #24      +/-   ##
==========================================
+ Coverage   95.71%   95.92%   +0.21%     
==========================================
  Files          13       13              
  Lines        1820     1768      -52     
==========================================
- Hits         1742     1696      -46     
+ Misses         78       72       -6     
Files with missing lines Coverage Δ
src/AdaptiveArrayPools.jl 100.00% <ø> (ø)
src/acquire.jl 89.41% <100.00%> (-0.54%) ⬇️
src/convenience.jl 98.13% <ø> (-1.08%) ⬇️
src/legacy/acquire.jl 94.92% <100.00%> (-0.32%) ⬇️
src/legacy/types.jl 97.91% <100.00%> (ø)
src/macros.jl 94.73% <100.00%> (+2.07%) ⬆️
src/task_local_pool.jl 100.00% <ø> (ø)
src/types.jl 95.23% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mgyoo86 mgyoo86 merged commit 506b98b into master Mar 7, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants