Skip to content

Conversation

@sunoru
Copy link
Member

@sunoru sunoru commented Feb 27, 2022

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Feb 27, 2022

Codecov Report

Merging #11 (95991e6) into master (840c556) will decrease coverage by 0.41%.
The diff coverage is 83.33%.

❗ Current head 95991e6 differs from pull request most recent head ef42ab2. Consider uploading reports for the commit ef42ab2 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #11      +/-   ##
==========================================
- Coverage   98.54%   98.12%   -0.42%     
==========================================
  Files           7        8       +1     
  Lines         822      853      +31     
==========================================
+ Hits          810      837      +27     
- Misses         12       16       +4     
Impacted Files Coverage Δ
src/aesni/aesni.jl 98.95% <ø> (ø)
src/aesni/ars.jl 98.33% <ø> (ø)
src/aesni/common.jl 85.71% <ø> (ø)
src/common.jl 93.90% <ø> (+0.31%) ⬆️
src/Random123.jl 83.33% <81.81%> (-16.67%) ⬇️
src/aesni/module.jl 100.00% <100.00%> (ø)
src/threefry.jl 99.54% <0.00%> (+<0.01%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 840c556...ef42ab2. Read the comment docs.

@sunoru
Copy link
Member Author

sunoru commented Mar 2, 2022

Looks good now...

@sunoru sunoru merged commit 7a74a75 into master Mar 2, 2022
@sunoru sunoru deleted the remove-deps branch March 2, 2022 20:47
@vchuravy
Copy link

vchuravy commented Mar 2, 2022

This broke downstream compilation of packages: See JuliaGPU/CUDA.jl#1422

@sunoru
Copy link
Member Author

sunoru commented Mar 2, 2022

Ah I missed this comment! I'll look into it later

function __init__()

R123_USE_AESNI[] = try
cmd = Base.julia_cmd()
Copy link

Choose a reason for hiding this comment

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

__init__ is for simple initialization; spawning a Julia process is not that and should not happen there. Either do this globally, and embed the use of AES-NI into the precompilation image (which should be safe, as that will not change across sessions) or make accesses to related functions lazy and have them initialize the bool upon first use.

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you mean by doing it globally? We used to do this in deps/build.jl but then decided that checking it every time the package is loaded may be better.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

Once, globally. const use_aesni = .... That'll be embedded in your precompiled package and not be evaluated every time you import the package. It's still better than deps/build.jl, which will only fire once when you install the package, since precompilation images are (should be) regenerated once the environment changes.

But again, for full flexibility, use a dynamic getter (a function that returns whether to use AES-NI, computes that lazily, and caches it per session). Look at how Flux.jl decides whether to use GPU support or not, for inspiration.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you so much. This is really helpful! I'm gonna have a look when I have time.

end

if R123_USE_AESNI[]
@eval using ._AESNIModule
Copy link

Choose a reason for hiding this comment

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

This is not allowed, and triggers JuliaGPU/CUDA.jl#1422.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have seen that. I realized @eval may not be necessary. Will look into this later..

Copy link

Choose a reason for hiding this comment

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

You cannot do a using at non-toplevel scope. So this will never work from __init__.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh I see... Is there a way to lazy load this? Like what Requires.jl does

Copy link

Choose a reason for hiding this comment

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

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.

5 participants