Skip to content

Wrong answers/crashes #301

@chriselrod

Description

@chriselrod
function readraw!(img, raw)
    npack = length(raw) ÷ 3
    @inbounds @simd for i in 0:npack-1
        img[1+4i] = raw[2+3i] << 4
        img[2+4i] = raw[1+3i]
        img[3+4i] = raw[2+3i]
        img[4+4i] = raw[3+3i]
    end
    imgv = reinterpret(UInt16,img)
    @inbounds @simd for i in 1:2npack
        imgv[i] >>>= 4
    end
    img
end
function readraw_turbo!(img, raw)
    npack = length(raw) ÷ 3
    @turbo for i in 0:npack-1
        img[1+4i] = raw[2+3i] << 4
        img[2+4i] = raw[1+3i]
        img[3+4i] = raw[2+3i]
        img[4+4i] = raw[3+3i]
    end
    img16 = reinterpret(UInt16,img)
    @turbo for i in 1:2npack
        img16[i] >>>= 4
    end
    img
end

w = 2048
raw = rand(UInt8, (3w*w) ÷ 4);
img1 = Matrix{UInt8}(undef, w, w); img2 = similar(img1);

readraw!(img1, raw)
readraw_turbo!(img2, raw)

This crashes on systems with AVX512:

julia: /home/chriselrod/Documents/languages/juliarelease/src/ccall.cpp:879: jl_cgval_t emit_llvmcall(jl_codectx_t&, jl_value_t**, size_t): Assertion `*it == f->getFunctionType()->getParamType(i)' failed.

On other systems, it apparently gets the wrong answer instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions