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

Doesn't build on powerpc64 #9

Open
pkubaj opened this issue Sep 3, 2020 · 4 comments
Open

Doesn't build on powerpc64 #9

pkubaj opened this issue Sep 3, 2020 · 4 comments

Comments

@pkubaj
Copy link

pkubaj commented Sep 3, 2020

I'm building as part of SuperCollider with LLVM 11 rc2 on FreeBSD:

/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/vec/vec_int_altivec.hpp:38:23: error: non-constant-expression cannot be narrowed from type 'int' to 'unsigned int' in initializer list [-Wc++11-narrowing]
        return (ivec){i, i, i, i};
                      ^
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/vec/vec_int_altivec.hpp:38:23: note: insert an explicit cast to silence this issue
        return (ivec){i, i, i, i};
                      ^
                      static_cast<unsigned int>( )
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/vec/vec_int_altivec.hpp:38:26: error: non-constant-expression cannot be narrowed from type 'int' to 'unsigned int' in initializer list [-Wc++11-narrowing]
        return (ivec){i, i, i, i};
                         ^
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/vec/vec_int_altivec.hpp:38:26: note: insert an explicit cast to silence this issue
        return (ivec){i, i, i, i};
                         ^
                         static_cast<unsigned int>( )
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/vec/vec_int_altivec.hpp:38:29: error: non-constant-expression cannot be narrowed from type 'int' to 'unsigned int' in initializer list [-Wc++11-narrowing]
        return (ivec){i, i, i, i};
                            ^
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/vec/vec_int_altivec.hpp:38:29: note: insert an explicit cast to silence this issue
        return (ivec){i, i, i, i};
                            ^
                            static_cast<unsigned int>( )
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/vec/vec_int_altivec.hpp:38:32: error: non-constant-expression cannot be narrowed from type 'int' to 'unsigned int' in initializer list [-Wc++11-narrowing]
        return (ivec){i, i, i, i};
                               ^
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/vec/vec_int_altivec.hpp:38:32: note: insert an explicit cast to silence this issue
        return (ivec){i, i, i, i};
                               ^
                               static_cast<unsigned int>( )
4 errors generated.

The following patch fixes build, but I'm not sure whether it causes any runtime issues:

--- external_libraries/nova-simd/vec/vec_int_altivec.hpp.orig   2020-09-03 23:55:08.848538000 +0200
+++ external_libraries/nova-simd/vec/vec_int_altivec.hpp        2020-09-03 23:58:16.614642000 +0200
@@ -35,7 +35,7 @@
     static ivec set_vector(int i)
     {
 #ifdef __GNUC__
-        return (ivec){i, i, i, i};
+        return (ivec){static_cast<unsigned int>(i), static_cast<unsigned int>(i), static_cast<unsigned int>(i), static_cast<unsigned int>(i)};
 #else
 #error compiler not supported
 #endif 
@timblechmann
Copy link
Owner

could you create a PR? i cannot test it, but if you're running on a ppc hardware, it might be a good idea to execute the unit tests

@pkubaj
Copy link
Author

pkubaj commented Sep 4, 2020

Tests currently don't build:

pkubaj@talos:$/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite$ make
[  3%] Linking CXX executable simd_unit_conversion_tests
[  6%] Built target simd_unit_conversion_tests
[ 10%] Building CXX object testsuite/CMakeFiles/simd_unary_tests.dir/simd_unary_tests.cpp.o
In file included from /tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/simd_unary_tests.cpp:4:
/usr/local/include/boost/test/floating_point_comparison.hpp:14:1: warning: This header is deprecated. Use This header is deprecated. Please use <boost/test/tools/floating_point_comparison.hpp> instead. instead. [-W#pragma-messages]
BOOST_HEADER_DEPRECATED( "This header is deprecated. Please use <boost/test/tools/floating_point_comparison.hpp> instead." )
^
/usr/local/include/boost/config/header_deprecated.hpp:23:37: note: expanded from macro 'BOOST_HEADER_DEPRECATED'
# define BOOST_HEADER_DEPRECATED(a) BOOST_PRAGMA_MESSAGE("This header is deprecated. Use " a " instead.")
                                    ^
/usr/local/include/boost/config/pragma_message.hpp:24:34: note: expanded from macro 'BOOST_PRAGMA_MESSAGE'
# define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x)))
                                 ^
<scratch space>:105:2: note: expanded from here
 message("This header is deprecated. Use " "This header is deprecated. Please use <boost/test/tools/floating_point_comparison.hpp> instead." " instead.")
 ^
In file included from /tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/simd_unary_tests.cpp:8:
In file included from /tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/test_helper.hpp:1:
/usr/local/include/boost/test/floating_point_comparison.hpp:14:1: warning: This header is deprecated. Use This header is deprecated. Please use <boost/test/tools/floating_point_comparison.hpp> instead. instead. [-W#pragma-messages]
BOOST_HEADER_DEPRECATED( "This header is deprecated. Please use <boost/test/tools/floating_point_comparison.hpp> instead." )
^
/usr/local/include/boost/config/header_deprecated.hpp:23:37: note: expanded from macro 'BOOST_HEADER_DEPRECATED'
# define BOOST_HEADER_DEPRECATED(a) BOOST_PRAGMA_MESSAGE("This header is deprecated. Use " a " instead.")
                                    ^
/usr/local/include/boost/config/pragma_message.hpp:24:34: note: expanded from macro 'BOOST_PRAGMA_MESSAGE'
# define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x)))
                                 ^
<scratch space>:108:2: note: expanded from here
 message("This header is deprecated. Use " "This header is deprecated. Please use <boost/test/tools/floating_point_comparison.hpp> instead." " instead.")
 ^
In file included from /tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/simd_unary_tests.cpp:11:
In file included from /tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/../simd_unary_arithmetic.hpp:22:
In file included from /tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/../vec/../detail/../vec.hpp:23:
In file included from /tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/../vec/vec_generic.hpp:28:
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/../vec/../detail/math.hpp:323:9: error: no viable conversion from 'nova::vec<float>' to 'bool'
    if (arg > 0) {
        ^~~~~~~
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/../simd_unary_arithmetic.hpp:63:37: note: in instantiation of function template specialization 'nova::detail::undenormalize<nova::vec<float>>' requested here
DEFINE_UNARY_FUNCTOR(undenormalize, undenormalize)
                                    ^
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/../vec/../detail/unroll_helpers.hpp:95:27: note: in instantiation of function template specialization 'nova::detail::undenormalize_::operator()<float>' requested here
        vec_type result = f(loaded_in1);
                          ^
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/../vec/../detail/unroll_helpers.hpp:47:46: note: in instantiation of function template specialization 'nova::detail::compile_time_unroller<float, 16>::mp_iteration_1<nova::detail::vector_pointer_argument<float>,
nova::detail::undenormalize_>' requested here
        compile_time_unroller<FloatType, N>::mp_iteration_1(out, in1.consume(), in1, f);
                                             ^
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/../vec/../detail/unroll_helpers.hpp:232:62: note: in instantiation of function template specialization 'nova::detail::compile_time_unroller<float, 16>::run<nova::detail::vector_pointer_argument<float>, nova::detail::undenormalize_>' requested here
        detail::compile_time_unroller<float_type, per_loop>::run(out, arg1, f);
                                                             ^
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/../detail/define_macros.hpp:47:23: note: in instantiation of function template specialization 'nova::detail::generate_simd_loop<float, nova::detail::vector_pointer_argument<float>, nova::detail::undenormalize_>'
requested here
        nova::detail::generate_simd_loop(out, nova::detail::wrap_vector_arg(wrap_argument(arg)), n, Functor());
                      ^
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/../simd_unary_arithmetic.hpp:78:1: note: in instantiation of function template specialization 'nova::detail::unary_functor<nova::detail::undenormalize_>::perform_vec_simd<float>' requested here
NOVA_SIMD_DEFINE_UNARY_WRAPPER(undenormalize, detail::undenormalize_)
^
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/../detail/define_macros.hpp:183:43: note: expanded from macro 'NOVA_SIMD_DEFINE_UNARY_WRAPPER'
    nova::detail::unary_functor<FUNCTOR>::perform_vec_simd<FloatType>(out, arg, n); \
                                          ^
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/simd_unary_tests.cpp:152:11: note: in instantiation of function template specialization 'nova::undenormalize_vec_simd<float>' requested here
    nova::undenormalize_vec_simd<float_type>(out_simd.c_array(), in.c_array(), size);
          ^
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/simd_unary_tests.cpp:160:5: note: in instantiation of function template specialization 'undenormalize_compare<float>' requested here
    undenormalize_compare<float>();
    ^
/tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite/../vec/vec_altivec.hpp:190:5: note: candidate function
    operator internal_vector_type (void) const
    ^
2 warnings and 1 error generated.
*** Error code 1

Stop.
make[2]: stopped in /tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd
*** Error code 1

Stop.
make[1]: stopped in /tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd
*** Error code 1

Stop.
make: stopped in /tmp/usr/ports/audio/supercollider/work/SuperCollider-3.11.0-Source/external_libraries/nova-simd/testsuite

@timblechmann
Copy link
Owner

i'm not sure if the ppc/altivec code was ever used in production, i merely wrote the altivec version as a proof of concept with a gcc of 10 years ago and tested it on qemu.
it seems that some parts might need some more love

@pkubaj
Copy link
Author

pkubaj commented Sep 4, 2020

If you'd like to fix it, but don't have the hardware, there are free PPC64 VM's for FOSS devs provided by OSU or Minicloud.

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