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

mod verify test for the half_type is failing to compile. #2488

Closed
umangyadav opened this issue Nov 30, 2023 · 3 comments · Fixed by #3125
Closed

mod verify test for the half_type is failing to compile. #2488

umangyadav opened this issue Nov 30, 2023 · 3 comments · Fixed by #3125
Assignees

Comments

@umangyadav
Copy link
Member

test_fmod_mod.cpp

here, modify test_mod to use half_type along with add_epsilon() function.

It runs into following compile error :

main.cpp:21:80: error: cannot convert between vector values of different size ('safe_vec<type, size>' (aka 'vec<conditional_t<is_same<float, bool>{}, uint8_t, float>, 2U>') and 'safe_vec<type, size>' (aka 'vec<conditional_t<is_same<_Float16, bool>{}, uint8_t, _Float16>, 2U>'))
auto z6 = migraphx::convert<half>(migraphx::fmod((migraphx::remainder(x1, z5)) + z5, z5));
                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
main.cpp:32:53: note: in instantiation of function template specialization 'migraphx::inner_pointwise<_Float16 __attribute__((ext_vector_type(2))), _Float16 __attribute__((ext_vector_type(2)))>' requested here
    pointwise(idx, vectorize<2, 0>())(MIGRAPHX_LIFT(inner_pointwise), private_p0,private_p1,private_p2);
                                                    ^
./migraphx/kernels/pointwise.hpp:40:66: note: while substituting deduced template arguments into function template 'operator()' [with private_lifts_xs:auto = <_Float16 & __attribute__((ext_vector_type(2))), _Float16 & __attribute__((ext_vector_type(2)))>]
                      [&](auto i) { out[i] = implicit_conversion(f(xs[i]...)); });
                                                                 ^
./migraphx/kernels/index.hpp:162:64: note: in instantiation of function template specialization 'migraphx::pointwise_tensor(index, (lambda at main.cpp:32:39), migraphx::tensor_view<_Float16 __attribute__((ext_vector_type(2))), migraphx::shape<migraphx::integral_const_array<unsigned int, 32>, migraphx::integral_const_array<unsigned int, 1>>>, migraphx::tensor_view<_Float16 __attribute__((ext_vector_type(2))), migraphx::shape<migraphx::integral_const_array<unsigned int, 32>, migraphx::integral_const_array<unsigned int, 1>>>, migraphx::tensor_view<_Float16 __attribute__((ext_vector_type(2))), migraphx::shape<migraphx::integral_const_array<unsigned int, 32>, migraphx::integral_const_array<unsigned int, 1>>>)::(anonymous class)::operator()<unsigned int>' requested here
    static constexpr auto invoke_loop(F f, I i, D) -> decltype(f(i))
                                                               ^
./migraphx/kernels/index.hpp:206:21: note: while substituting deduced template arguments into function template 'invoke_loop' [with F = (lambda at ./migraphx/kernels/pointwise.hpp:40:23), I = index_int, D = integral_constant<decltype(0), 0>]
                    invoke_loop(f, start, _c<0>);
                    ^
./migraphx/kernels/index.hpp:230:9: note: in instantiation of function template specialization 'migraphx::index::for_stride<false, (lambda at ./migraphx/kernels/pointwise.hpp:40:23), migraphx::integral_constant<unsigned int, 32>, migraphx::integral_constant<unsigned int, 32>>' requested here
        for_stride<false>(global, n, nglobal(), f);
        ^
./migraphx/kernels/pointwise.hpp:39:9: note: in instantiation of function template specialization 'migraphx::index::global_stride<(lambda at ./migraphx/kernels/pointwise.hpp:40:23), migraphx::integral_constant<unsigned int, 32>>' requested here
    idx.global_stride(out.get_shape().elements(),
        ^
./migraphx/kernels/pointwise.hpp:48:36: note: in instantiation of function template specialization 'migraphx::pointwise_tensor<(lambda at main.cpp:32:39), migraphx::tensor_view<_Float16 __attribute__((ext_vector_type(2))), migraphx::shape<migraphx::integral_const_array<unsigned int, 32>, migraphx::integral_const_array<unsigned int, 1>>>, migraphx::tensor_view<_Float16 __attribute__((ext_vector_type(2))), migraphx::shape<migraphx::integral_const_array<unsigned int, 32>, migraphx::integral_const_array<unsigned int, 1>>>, migraphx::tensor_view<_Float16 __attribute__((ext_vector_type(2))), migraphx::shape<migraphx::integral_const_array<unsigned int, 32>, migraphx::integral_const_array<unsigned int, 1>>>>' requested here
        t(ps...)([&](auto... xs) { pointwise_tensor(idx, f, xs...); });
                                   ^
./migraphx/kernels/pointwise.hpp:40:66: error: no matching function for call to object of type '(lambda at main.cpp:32:39)'
                      [&](auto i) { out[i] = implicit_conversion(f(xs[i]...)); });
                                                                 ^
./migraphx/kernels/index.hpp:162:64: note: in instantiation of function template specialization 'migraphx::pointwise_tensor(index, (lambda at main.cpp:32:39), migraphx::tensor_view<_Float16 __attribute__((ext_vector_type(2))), migraphx::shape<migraphx::integral_const_array<unsigned int, 32>, migraphx::integral_const_array<unsigned int, 1>>>, migraphx::tensor_view<_Float16 __attribute__((ext_vector_type(2))), migraphx::shape<migraphx::integral_const_array<unsigned int, 32>, migraphx::integral_const_array<unsigned int, 1>>>, migraphx::tensor_view<_Float16 __attribute__((ext_vector_type(2))), migraphx::shape<migraphx::integral_const_array<unsigned int, 32>, migraphx::integral_const_array<unsigned int, 1>>>)::(anonymous class)::operator()<unsigned int>' requested here
    static constexpr auto invoke_loop(F f, I i, D) -> decltype(f(i))
                                                               ^
./migraphx/kernels/index.hpp:206:21: note: while substituting deduced template arguments into function template 'invoke_loop' [with F = (lambda at ./migraphx/kernels/pointwise.hpp:40:23), I = index_int, D = integral_constant<decltype(0), 0>]
                    invoke_loop(f, start, _c<0>);
                    ^
./migraphx/kernels/index.hpp:230:9: note: in instantiation of function template specialization 'migraphx::index::for_stride<false, (lambda at ./migraphx/kernels/pointwise.hpp:40:23), migraphx::integral_constant<unsigned int, 32>, migraphx::integral_constant<unsigned int, 32>>' requested here
        for_stride<false>(global, n, nglobal(), f);
        ^
./migraphx/kernels/pointwise.hpp:39:9: note: in instantiation of function template specialization 'migraphx::index::global_stride<(lambda at ./migraphx/kernels/pointwise.hpp:40:23), migraphx::integral_constant<unsigned int, 32>>' requested here
    idx.global_stride(out.get_shape().elements(),
        ^
./migraphx/kernels/pointwise.hpp:48:36: note: in instantiation of function template specialization 'migraphx::pointwise_tensor<(lambda at main.cpp:32:39), migraphx::tensor_view<_Float16 __attribute__((ext_vector_type(2))), migraphx::shape<migraphx::integral_const_array<unsigned int, 32>, migraphx::integral_const_array<unsigned int, 1>>>, migraphx::tensor_view<_Float16 __attribute__((ext_vector_type(2))), migraphx::shape<migraphx::integral_const_array<unsigned int, 32>, migraphx::integral_const_array<unsigned int, 1>>>, migraphx::tensor_view<_Float16 __attribute__((ext_vector_type(2))), migraphx::shape<migraphx::integral_const_array<unsigned int, 32>, migraphx::integral_const_array<unsigned int, 1>>>>' requested here
        t(ps...)([&](auto... xs) { pointwise_tensor(idx, f, xs...); });
                                   ^
main.cpp:32:39: note: candidate template ignored: substitution failure [with private_lifts_xs:auto = <_Float16 & __attribute__((ext_vector_type(2))), _Float16 & __attribute__((ext_vector_type(2)))>]
    pointwise(idx, vectorize<2, 0>())(MIGRAPHX_LIFT(inner_pointwise), private_p0,private_p1,private_p2);
                                      ^
./migraphx/kernels/functional.hpp:35:5: note: expanded from macro 'MIGRAPHX_LIFT'
    [](auto&&... private_lifts_xs) MIGRAPHX_RETURNS( \
    ^
In file included from main.cpp:2:
./migraphx/kernels/index.hpp:206:21: error: no matching function for call to 'invoke_loop'
                    invoke_loop(f, start, _c<0>);
                    ^~~~~~~~~~~
./migraphx/kernels/index.hpp:230:9: note: in instantiation of function template specialization 'migraphx::index::for_stride<false, (lambda at ./migraphx/kernels/pointwise.hpp:40:23), migraphx::integral_constant<unsigned int, 32>, migraphx::integral_constant<unsigned int, 32>>' requested here
        for_stride<false>(global, n, nglobal(), f);
        ^
./migraphx/kernels/pointwise.hpp:39:9: note: in instantiation of function template specialization 'migraphx::index::global_stride<(lambda at ./migraphx/kernels/pointwise.hpp:40:23), migraphx::integral_constant<unsigned int, 32>>' requested here
    idx.global_stride(out.get_shape().elements(),
        ^
./migraphx/kernels/pointwise.hpp:48:36: note: in instantiation of function template specialization 'migraphx::pointwise_tensor<(lambda at main.cpp:32:39), migraphx::tensor_view<_Float16 __attribute__((ext_vector_type(2))), migraphx::shape<migraphx::integral_const_array<unsigned int, 32>, migraphx::integral_const_array<unsigned int, 1>>>, migraphx::tensor_view<_Float16 __attribute__((ext_vector_type(2))), migraphx::shape<migraphx::integral_const_array<unsigned int, 32>, migraphx::integral_const_array<unsigned int, 1>>>, migraphx::tensor_view<_Float16 __attribute__((ext_vector_type(2))), migraphx::shape<migraphx::integral_const_array<unsigned int, 32>, migraphx::integral_const_array<unsigned int, 1>>>>' requested here
        t(ps...)([&](auto... xs) { pointwise_tensor(idx, f, xs...); });
                                   ^
./migraphx/kernels/index.hpp:156:27: note: candidate template ignored: substitution failure [with F = (lambda at ./migraphx/kernels/pointwise.hpp:40:23), I = index_int, D = integral_constant<decltype(0), 0>]: no matching function for call to object of type '(lambda at ./migraphx/kernels/pointwise.hpp:40:23)'
    static constexpr auto invoke_loop(F f, I i, D d) -> decltype(f(i, d))
                          ^                                      ~
./migraphx/kernels/index.hpp:162:27: note: candidate template ignored: substitution failure [with F = (lambda at ./migraphx/kernels/pointwise.hpp:40:23), I = index_int, D = integral_constant<decltype(0), 0>]
    static constexpr auto invoke_loop(F f, I i, D) -> decltype(f(i))
                          ^
3 errors generated when compiling for gfx942.

module: "main"
output = @param:output -> half_type, {64}, {1}, target_id=0
y = @param:y -> half_type, {64}, {1}, target_id=0
x = @param:x -> half_type, {64}, {1}, target_id=0
@3 = gpu::precompile_op[op=pointwise,additional_args=1,ignore_modules=0](y,x,output), [main:pointwise0] -> half_type, {64}, {1}, target_id=0
@4 = identity(@3) -> half_type, {64}, {1}, target_id=0

module: "main:pointwise0"
main:pointwise0:x1 = @param:x1 -> half_type, {1}, {0}, target_id=0
main:pointwise0:@1 = @literal{0.000999451} -> half_type, {1}, {0}, target_id=0
main:pointwise0:@2 = @literal{0} -> half_type, {1}, {0}, target_id=0
main:pointwise0:x0 = @param:x0 -> half_type, {1}, {0}, target_id=0
main:pointwise0:@4 = equal(main:pointwise0:x0,main:pointwise0:@2) -> half_type, {1}, {0}, target_id=0
main:pointwise0:@5 = where(main:pointwise0:@4,main:pointwise0:@1,main:pointwise0:x0) -> half_type, {1}, {0}, target_id=0
main:pointwise0:@6 = mod(main:pointwise0:x1,main:pointwise0:@5) -> half_type, {1}, {0}, target_id=0
main:pointwise0:@7 = @return(main:pointwise0:@6), target_id=0

@gyulaz-htec
Copy link
Collaborator

We saw this with int8 and int32 as well: #2268

@umangyadav
Copy link
Member Author

umangyadav commented May 27, 2024

@gyulaz-htec Does your PR #3086 fixes the failure for this issue as well ?
If so can you please enable following test as well in your PR ?

// template struct test_mod<migraphx::shape::half_type>;
?

@gyulaz-htec
Copy link
Collaborator

@umangyadav this is fixed now. I've created a PR to enable this test.

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 a pull request may close this issue.

2 participants