Repository navigation
ARROW-9688: [C++][Python] Enable building c++ library and pyarrow package for win/arm64 build - #11383
niyas-sait wants to merge 6 commits into
Conversation
|
|
cyb70289
left a comment
There was a problem hiding this comment.
Thanks @nsait-linaro for enabling arrow on windows/arm64.
Just out of curiosity, is there free resources (e.g., cloud based) to try windows on arm?
I don't think one is available yet. We can still cross-compile for ARM64 from an x64 machine. I will try to put together a CI for build at least until the VMs for ARM64 is up and running in azure. |
|
Failing CI flow seems to be due to missing LLVM. It doesn't look related to this patch. Is this a known issue? |
It's known issue. Not related to this PR. |
There was a problem hiding this comment.
Do you have details why this change? And your original PR works without this change?
There was a problem hiding this comment.
Apparently, clang for windows on arm64 has some bugs around int128_t type. The issue is very similar to the linker issue highlighted in line 900.
if(ARROW_USE_UBSAN)
# NOTE: Avoid native int128_t on clang with UBSan as it produces linker errors
# (such as "undefined reference to '__muloti4'")
set(ARROW_USE_NATIVE_INT128 FALSE)
else()
For example even simple programs like following would throw an error
int main(){
__int128_t x, y;
// int128_t div
auto r = x / y;
// cast int128_t to float
float mean = static_cast<float>(x);
return 0;
}
Linker error raised
lld-link: error: undefined symbol: __divti3
>>> referenced by C:\Users\niysai01\AppData\Local\Temp\test-ed00b3.o:(main)
lld-link: error: undefined symbol: __floattisf
>>> referenced by C:\Users\niysai01\AppData\Local\Temp\test-ed00b3.o:(main)
I am waiting for an LLVM account to file a bug report.
I had this change initially but then reverted it thinking that it wasn't necessary and since I wasn't doing a clean build this didn't show up as an issue after reverting. I have tried on a clean checkout yesterday and can confirm that this change is required.
There was a problem hiding this comment.
I tried llvm-13 [1] and found this bug is fixed. Will you test it?
EDIT: Looks not fixed. There are still similar errors somewhere else. Sorry for the noise.
There was a problem hiding this comment.
Yes, I just tried and gives the same error. Thanks for confirming.
There was a problem hiding this comment.
For the record. Below command does gives me a successful build of your test code.
clang-cl /clang:"--rtlib=compiler-rt" test.c
There was a problem hiding this comment.
Does this work on x64 windows?
Just an educated guess: from the looks of it, and @cyb70289 's comment, it looks like an incompatibility between clang-cl and MSVC's runtime libraries -- clang-cl generates calls to __*ti3() functions expecting them in the runtime libs. Compiler-rt does provide them, but MSVC's libraries do not.
There was a problem hiding this comment.
I've tested. Same issue happens on x64 windows. @maxim-kuvyrkov
There was a problem hiding this comment.
Clang targeting windows-msvc expects to link against the VC++ runtime. But VC++ doesnt support __int128 intrinsic which explain why using --rtlib=compiler-rt compiles the code fine.
See link below for reference:
https://docs.microsoft.com/en-us/cpp/cpp/fundamental-types-cpp?view=msvc-160#integer-types
This appears to be a known issue in community but I could not find a bug report against it. Please refer to following upstream discussions:
https://reviews.llvm.org/D91139#2429595
https://reviews.llvm.org/D91413
There was a problem hiding this comment.
Apparently, clang for windows on arm64 has some bugs around int128_t type. The issue is very similar to the linker issue highlighted in line 900.
if(ARROW_USE_UBSAN) # NOTE: Avoid native int128_t on clang with UBSan as it produces linker errors # (such as "undefined reference to '__muloti4'") set(ARROW_USE_NATIVE_INT128 FALSE) else()For example even simple programs like following would throw an error
int main(){ __int128_t x, y; // int128_t div auto r = x / y; // cast int128_t to float float mean = static_cast<float>(x); return 0; }Linker error raised
lld-link: error: undefined symbol: __divti3 >>> referenced by C:\Users\niysai01\AppData\Local\Temp\test-ed00b3.o:(main) lld-link: error: undefined symbol: __floattisf >>> referenced by C:\Users\niysai01\AppData\Local\Temp\test-ed00b3.o:(main)I am waiting for an LLVM account to file a bug report.
I had this change initially but then reverted it thinking that it wasn't necessary and since I wasn't doing a clean build this didn't show up as an issue after reverting. I have tried on a clean checkout yesterday and can confirm that this change is required.
This looks more like a feature request where we want Clang to enable VC++ missing intrinsic like __int128 from compiler-rt when building for MSVC
|
@nsait-linaro , I installed windows on arm in apple m1 box. Tried your patch and it looks great. Except c++ unit test build failed. I have pushed a pr to fix the build errors #11495, will rebase when that pr is merged. |
Thanks , sounds good |
c3b1935 to
cb33e20
Compare
cyb70289
left a comment
There was a problem hiding this comment.
+1, thanks @nsait-linaro !
|
R4.1 job failed (looks timed out). Maybe a spurious error? @nealrichardson [UPDATE] No worry, I rerun the test, it's passing now. |
|
Benchmark runs are scheduled for baseline = 61a2212 and contender = 0f3e36e. 0f3e36e is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
👍 For the future, if you see any of the R jobs hanging/timing out, please note it on https://issues.apache.org/jira/browse/ARROW-14159 with any useful details. We tried to eliminate the sources of the hanging but it looks like we haven't found them all yet. |
|
Thanks, everyone for your help to get it merged. As the changes are merged now, It would be good to look at CI options for win/arm64 build. We have a few machines available in Linaro WoA64 farm which we could allocate for testing Arrow. What would be a good channel to kick start this discussion? |
|
Arrow dev mail list is the best place to talk about it. |
The patch will enable building arrow c++ library and pyarrow package for windows/arm64 targets using clang-cl and ninja toolchain.
The patch contains steps to build c++ library for basic configuration. Library with Python can be built similar to other platforms.
MSVC cannot be yet used for win/arm64 build as some of the templates from xsimd and boost are not properly handled by MSVC.
PyArrow can be built with Ninja and clang-cl by setting the following environment variables
PyArrow tests are all passing