Comments (6)
Hi @vthib ,
Can you provide a pointer that explicitly states that fftw_malloc
returns arrays aligned on 16 bits ?
I tried to find one and could not.
from concrete.
FFTW allocates using this routine: https://github.com/FFTW/fftw3/blob/master/kernel/kalloc.c#L71
It uses MIN_ALIGNMENT
, defined here: https://github.com/FFTW/fftw3/blob/master/kernel/ifftw.h#L133
So it seems to use 32 bytes alignment if a certain number of conditions is met. On my distrib (arch), fftw is compiled with --enable-avx, which makes this 32 bytes alignment used afaict. But in rust-fftw, this is probably not the case.
Anyway, this seems quite hard to enforce, unless a patch is done in rust-fftw to enable avx if fftw is compiled, + an assert is added. Even with this solution it seems quite brittle.
Imho, the best solution would be to drop the use of AlignedVec from fftw, and use a custom new type, using #[repr(C, align(32)]
.
This also raises an interesting issue, if we want the best possible performance, fftw should be compiled with aggressive options, which does not seem to be the case
from concrete.
I can do a PR with:
- a in-house AlignedVec where we control the alignment (forced on 32 bytes), that is a drop-in replacement for the fftw AlignedVec everywhere
- asserts in the avx method to ensure alignment is correct.
Would that be ok for you?
from concrete.
Hey @vthib,
We are currently forking the rust_fftw
wrapper, so I would prefer us to arrange for that in this new wrapper.
from concrete.
There would be a big benefit in doing it in concrete
, it would decouple concrete
from fftw
. Right now we have functions that depends on AlignedVec for optimizations, but that isn't related to fft at all. Having AlignedVec
in concrete
would remove this dependency, making it much easier to use another fft library, for benchmarking or targeting wasm for example.
The Rust implem for AlignedVec
is actually quite clean as well
from concrete.
The concrete-fftw
crate now forces the alignment of the AlignedVec
structure to 32 bytes, which solves the segfault. We may consider adding an AlignedVec
to concrete when we refactor it to support rustfft.
Closing.
from concrete.
Related Issues (20)
- Attempt to read property "pTemplateID" on null in Page.php HOT 2
- Make Mul, DotEintEint, MatMulEintEint support multi-precision HOT 1
- Help for installing Concrete version 1.0.0-beta HOT 4
- Error while setting up Concrete-Python for development HOT 13
- Comparison sequence of enc_numbers HOT 2
- 【source compile】ModuleNotFoundError: No module named 'mlir._mlir_libs'
- Cannot query encrypted KeyValueDatabase examples HOT 2
- if_then_else support clear values for branch result HOT 1
- Fail to run the quick start with docker HOT 4
- Startup failed HOT 1
- Compilation failing with "RuntimeError: Cannot open compilation feedback" HOT 3
- Concrete-Python ARM image for Linux HOT 3
- Update Makefile so tests run on Raspberry Pi don't fail due to resource constraints. HOT 1
- keygen method's encryption_seed value actually refers to secret_seed HOT 1
- Sample code crashes on Apple M1 HOT 1
- Support of **please-fill** in Concrete HOT 2
- Can I implementation of Luhn's algorithm to validate a credit card number encrypted using homomorphic encryption, using concrete TFHE Compiler? HOT 3
- Key-value database examples not working (seems to be a regression in 2.6.0, used to work for 2.5.0) HOT 7
- Segmentation Fault HOT 21
- How to reproduce the NN inference experiments in eprint.iacr.org/2021/091 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from concrete.