Can you do something similar to a multiply-high in HLSL?
mul_hi in opencl
What it is:
http://stackoverflow...ply-high-signed
HLSL Multiply High
SM5 hardware does support integer instructions, but there are no 64-bit ints available in HLSL.
The code in the linked article seems to multiply the first 16 bits of the parameters to 32-bit, so that particular function would work on the SM5 GPU with only minor modification (change "unsigned" to "uint" and you're good to go).
Note that integer instructions can be slower than float ops in GPU, because there are generally fewer integer-capable computation units available. The instructions themselves are simple in this case, though.
The code in the linked article seems to multiply the first 16 bits of the parameters to 32-bit, so that particular function would work on the SM5 GPU with only minor modification (change "unsigned" to "uint" and you're good to go).
Note that integer instructions can be slower than float ops in GPU, because there are generally fewer integer-capable computation units available. The instructions themselves are simple in this case, though.
I wrote some test stuff in OpenCL, and it seems to emit 64 bit multiplies on my GPU.
I went and read the HLSL assembly reference, and the instruction umul
http://msdn.microsof...0(v=vs.85).aspx
does exactly what I want. Is there a way to 'get at' instruction function?
I went and read the HLSL assembly reference, and the instruction umul
http://msdn.microsof...0(v=vs.85).aspx
does exactly what I want. Is there a way to 'get at' instruction function?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement