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

sub_group_non_uniform_scan_exclusive_logical_and only check int value, not check non-zero. #2051

Open
neoming opened this issue Aug 16, 2024 · 0 comments

Comments

@neoming
Copy link

neoming commented Aug 16, 2024

For exclusive_logical_and, the identity value is true (non-zero).

image

But if the identity is 0xffff ffff, the OpenCL-CTS will report an error. Which is compared by compare_ordered(rr, tr).

tr = TypeManager<Ty>::identify_limits(operation);
for (const int &active_work_item : active_work_items)
{
    rr = my[ii + active_work_item];
    if (!compare_ordered(rr, tr))
    {
        log_error(
            "ERROR: %s_%s(%s) "
            "mismatch for local id %d in sub group %d in "
            "group %d %s\n",
            func_name.c_str(), operation_names(operation),
            TypeManager<Ty>::name(), i, j, k,
            print_expected_obtained(tr, rr).c_str());
        return TEST_FAIL;
    }
    tr = calculate<Ty>(tr, mx[ii + active_work_item],
                        operation);
}

The compare_ordered useing == to compare cl_int type.

template <typename Ty> inline bool compare_ordered(const Ty &lhs, const Ty &rhs)
{
    return lhs == rhs;
}

And identify_limits will return (cl_int)1 for logical_and.

template <> struct TypeManager<cl_int> : public CommonTypeManager<cl_int>
{
    ...
    static cl_int identify_limits(ArithmeticOp operation)
    {
        switch (operation)
        {
            case ArithmeticOp::add_: return (cl_int)0;
            case ArithmeticOp::max_:
                return (std::numeric_limits<cl_int>::min)();
            case ArithmeticOp::min_:
                return (std::numeric_limits<cl_int>::max)();
            case ArithmeticOp::mul_: return (cl_int)1;
            case ArithmeticOp::and_: return (cl_int)~0;
            case ArithmeticOp::or_: return (cl_int)0;
            case ArithmeticOp::xor_: return (cl_int)0;
            case ArithmeticOp::logical_and: return (cl_int)1;
            case ArithmeticOp::logical_or: return (cl_int)0;
            case ArithmeticOp::logical_xor: return (cl_int)0;
            default: log_error("Unknown operation request\n"); break;
        }
        return 0;
    }
};

So actually CTS compares -1(0xffff ffff) == 1 to verify the result, which does not meet the non-zero requirement.

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

1 participant