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

Mono LLVMAOT fails for Sse2_r and Sse2_ro with Invalid Record #102037

Open
tannergooding opened this issue May 9, 2024 · 2 comments
Open

Mono LLVMAOT fails for Sse2_r and Sse2_ro with Invalid Record #102037

tannergooding opened this issue May 9, 2024 · 2 comments

Comments

@tannergooding
Copy link
Member

As per the title the Sse2_r and Sse2_ro hardware intrinsics projects fail compiling with errors similar to the following:

 /__w/1/s/artifacts/bin/mono/linux.x64.Release/opt: mono_aot_dFNFkp/temp.bc: error: Invalid record (Producer: 'LLVM16.0.5' Reader: 'LLVM 16.0.5')
  AOT of image /__w/1/s/artifacts/tests/coreclr/linux.x64.Release/JIT/HardwareIntrinsics/HardwareIntrinsics_X86_r/X86_Sse2_r.dll failed.
  Mono Ahead of Time compiler - compiling assembly /__w/1/s/artifacts/tests/coreclr/linux.x64.Release/JIT/HardwareIntrinsics/HardwareIntrinsics_X86_r/X86_Sse2_r.dll

This was found in #101886 after extending various tests to include new coverage in the form of the following (that is, the same as the existing RuneBasicScenario but using Vector.Create and Vector.ConditionalSelect as part of the scenario to ensure that embedded broadcasts and embedded masking could be validated.

public void RunBroadcastScenario()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunBroadcastScenario));

            var result = {Isa}.{Method}(
                Unsafe.Read<{Op1VectorType}<{Op1BaseType}>>(_dataTable.inArray1Ptr),
                {Op2VectorType}.Create<{Op2BaseType}>(Unsafe.Read<{Op2BaseType}>(_dataTable.inArray2Ptr))
            );

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr, isBroadcast: true);
        }

        public void RunMaskingValueScenario()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunMaskingValueScenario));

            var op1 = Unsafe.Read<{Op1VectorType}<{Op1BaseType}>>(_dataTable.inArray1Ptr);

            var result = {RetVectorType}.ConditionalSelect(
                {RetVectorType}.Equals<{RetBaseType}>(op1.As{RetBaseType}(), {RetVectorType}<{RetBaseType}>.Zero),
                {Isa}.{Method}(
                    op1,
                    Unsafe.Read<{Op2VectorType}<{Op2BaseType}>>(_dataTable.inArray2Ptr)
                ),
                {RetVectorType}.Create<{RetBaseType}>(1)
            );

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr, mask: 1);
        }

        public void RunMaskingZeroScenario()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunMaskingZeroScenario));

            var op1 = Unsafe.Read<{Op1VectorType}<{Op1BaseType}>>(_dataTable.inArray1Ptr);

            var result = {RetVectorType}.ConditionalSelect(
                {RetVectorType}.Equals<{RetBaseType}>(op1.As{RetBaseType}(), {RetVectorType}<{RetBaseType}>.Zero),
                {Isa}.{Method}(
                    op1,
                    Unsafe.Read<{Op2VectorType}<{Op2BaseType}>>(_dataTable.inArray2Ptr)
                ),
                {RetVectorType}<{RetBaseType}>.Zero
            );

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr, mask: 0);
        }

        public void RunBroadcastAndMaskingScenario()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunBroadcastAndMaskingScenario));

            var op1 = Unsafe.Read<{Op1VectorType}<{Op1BaseType}>>(_dataTable.inArray1Ptr);

            var result = {RetVectorType}.ConditionalSelect(
                {RetVectorType}.Equals<{RetBaseType}>(op1.As{RetBaseType}(), {RetVectorType}<{RetBaseType}>.Zero),
                {Isa}.{Method}(
                    op1,
                    {Op2VectorType}.Create<{Op2BaseType}>(Unsafe.Read<{Op2BaseType}>(_dataTable.inArray2Ptr))
                ),
                {RetVectorType}<{RetBaseType}>.Zero
            );

            Unsafe.Write(_dataTable.outArrayPtr, result);
            ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr, isBroadcast: true, mask: 0);
        }
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label May 9, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label May 9, 2024
@tannergooding tannergooding added area-Codegen-LLVM-mono and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels May 9, 2024
Copy link
Contributor

Tagging subscribers to this area: @lambdageek, @steveisok
See info in area-owners.md if you want to be subscribed.

@steveisok
Copy link
Member

/cc @fanyang-mono

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants