Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS arm64 test failure: cconv_array.t #604

Closed
shoe42 opened this issue Aug 23, 2022 · 18 comments
Closed

macOS arm64 test failure: cconv_array.t #604

shoe42 opened this issue Aug 23, 2022 · 18 comments

Comments

@shoe42
Copy link
Contributor

shoe42 commented Aug 23, 2022

The cconv_array.t test fails on macOS arm64 (M1). macOS 12.5, using system clang and Homebrew LLVM 13. Trimmed output:

$ ../build/bin/terra cconv_array.t
running test for int8[0]
running test for int8[1]
running test for int8[2]
running test for int8[3]
running test for int8[4]
running test for int8[5]
running test for int8[6]
running test for int8[7]
running test for int8[8]
running test for int8[9]
cconv_array.t:53: NYI: cannot call this C function (yet)
stack traceback:
	[C]: in function 'caller'
	cconv_array.t:53: in function 'run_test_case'
	cconv_array.t:64: in main chunk
@elliottslaughter
Copy link
Member

elliottslaughter commented Aug 23, 2022

I suspect this is a LuaJIT bug.

Can you please help me with this test?

bug604.c:

#include <stdint.h>

int8_t f(int8_t x0, int8_t x1, int8_t x2, int8_t x3, int8_t x4, int8_t x5, int8_t x6, int8_t x7, int8_t x8, int8_t x9) {
  return x0 + x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9;
}

bug604.t:

local c = terralib.includecstring [[
#include <stdint.h>

int8_t f(int8_t x0, int8_t x1, int8_t x2, int8_t x3, int8_t x4, int8_t x5, int8_t x6, int8_t x7, int8_t x8, int8_t x9);
]]

terralib.linklibrary("libbug604.dylib")

print(c.f(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))

bug604.lua:

local ffi = require("ffi")

ffi.cdef [[
int8_t f(int8_t x0, int8_t x1, int8_t x2, int8_t x3, int8_t x4, int8_t x5, int8_t x6, int8_t x7, int8_t x8, int8_t x9);
]]

local c = ffi.load("libbug604")

print(c.f(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))

Then run:

clang bug604.c -o libbug604.dylib -shared -Wall
./build/bin/terra bug604.t
./build/bin/terra bug604.lua

It should print 45 with each of the last two commands, but I suspect it will fail with both.

@shoe42
Copy link
Contributor Author

shoe42 commented Aug 23, 2022

Looks like it's still failing:

$ ../build/bin/terra bug604.t
bug604.t:9: NYI: cannot call this C function (yet)
stack traceback:
	[C]: in function 'f'
	bug604.t:9: in main chunk
$ ../build/bin/terra bug604.lua
bug604.lua:9: NYI: cannot call this C function (yet)
stack traceback:
	[C]: in function 'f'
	bug604.lua:9: in main chunk

@elliottslaughter
Copy link
Member

Ok, definitely a LuaJIT bug. I'll file an issue shortly. It might help to have:

  1. uname -a
  2. XCode version (whether full XCode app or command line tools, output of clang --version)
  3. macOS version

@shoe42
Copy link
Contributor Author

shoe42 commented Aug 23, 2022

Version info:

  • macOS 12.5.1
  • uname -a: Darwin localhost 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:35 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T8101 arm64
  • Xcode 13.4.1
  • Apple clang version 13.1.6 (clang-1316.0.21.2.5), target arm64-apple-darwin21.6.0

@elliottslaughter
Copy link
Member

Upstream issue submitted: LuaJIT/LuaJIT#888

@elliottslaughter
Copy link
Member

The upstream issue was closed as a duplicate of LuaJIT/LuaJIT#205, which has been open for six years with no indication of being a priority. I think at this point the best we can do is modify the bounds on this test so that we stick to what works.

@elliottslaughter
Copy link
Member

@shoe42 Is this still failing? What does the output look like on master now?

@shoe42
Copy link
Contributor Author

shoe42 commented Sep 2, 2022

Looks like on commit 71f2180, the test fails with:

$ ../build/bin/terra cconv_array.t
running test for int8[0]
running test for int8[1]
running test for int8[2]
running test for int8[3]
running test for int8[4]
running test for int8[5]
running test for int8[6]
running test for int8[7]
running test for int8[8]
running test for int16[0]
running test for int16[1]
running test for int16[2]
running test for int16[3]
running test for int16[4]
running test for int16[5]
running test for int16[6]
running test for int16[7]
running test for int16[8]
running test for int16[9]
cconv_array.t:53: NYI: cannot call this C function (yet)
stack traceback:
	[C]: in function 'caller'
	cconv_array.t:53: in function 'run_test_case'
	cconv_array.t:74: in main chunk

@elliottslaughter
Copy link
Member

Sigh. Ok, if you take out int16 for a moment, does it fail on int32 too? I can work around this but would like to know what types I'll need to do so for.

@shoe42
Copy link
Contributor Author

shoe42 commented Sep 2, 2022

int32:

running test for int32[0]
running test for int32[1]
running test for int32[2]
running test for int32[3]
running test for int32[4]
running test for int32[5]
running test for int32[6]
running test for int32[7]
running test for int32[8]
running test for int32[9]
cconv_array.t:53: NYI: cannot call this C function (yet)
stack traceback:
	[C]: in function 'caller'
	cconv_array.t:53: in function 'run_test_case'
	cconv_array.t:74: in main chunk

float:

running test for float[0]
running test for float[1]
running test for float[2]
running test for float[3]
running test for float[4]
running test for float[5]
running test for float[6]
running test for float[7]
running test for float[8]
running test for float[9]
cconv_array.t:53: NYI: cannot call this C function (yet)
stack traceback:
	[C]: in function 'caller'
	cconv_array.t:53: in function 'run_test_case'
	cconv_array.t:74: in main chunk

int64 and double seem to all pass.

@elliottslaughter
Copy link
Member

Thanks. I'll make a new workaround.

@elliottslaughter
Copy link
Member

Can you try running the version of cconv_array.t in #611 and let me know if it works this time?

@shoe42
Copy link
Contributor Author

shoe42 commented Sep 5, 2022

Yup, looks like that PR makes cconv_array.t pass tests now.

@elliottslaughter
Copy link
Member

Thanks! Merged. I think all tests should pass in master now.

@elliottslaughter
Copy link
Member

@shoe42 if you'd like to do one last check, I can get a release rolling.

@shoe42
Copy link
Contributor Author

shoe42 commented Sep 6, 2022

Looks like everything is passing successfully - thanks for the work in bringing M1 test pass rate up to scratch!

@elliottslaughter
Copy link
Member

Thanks, will release here shortly.

@elliottslaughter
Copy link
Member

Just FYI: as of #642 I have pulled in an updated LuaJIT that fixes the root cause, and with that, we can now run the full cconv_array.t test again.

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

No branches or pull requests

2 participants