Hi. There's this thread from September (https://www.winehq.org/pipermail/wine-devel/2019-September/150657.html) (Sorry, can't reply to it directly, as I wasn't on the ML at the time). I'd like to dig into DXIL translation, but there is risk of duplicating work.
Greg: Got any status update?
Cheers, Hans-Kristian
I confess I got a bit sidelined on this by some other projects, but I'm at a point where I can take it up again.
The status is that I can parse the DXIL produced by DXC for a simple passthrough shader, but I can't generate the spir-v yet.
I didn't think that was sufficient progress to wrap into a patch and get feedback on, but if you'd like to see it, I can polish it up and do so.
Greg
On Fri, Oct 18, 2019 at 8:10 AM Hans-Kristian Arntzen < post@arntzen-software.no> wrote:
Hi. There's this thread from September (https://www.winehq.org/pipermail/wine-devel/2019-September/150657.html) (Sorry, can't reply to it directly, as I wasn't on the ML at the time). I'd like to dig into DXIL translation, but there is risk of duplicating work.
Greg: Got any status update?
Cheers, Hans-Kristian
On 10/18/19 4:15 PM, Greg Roth wrote:
I confess I got a bit sidelined on this by some other projects, but I'm at a point where I can take it up again.
The status is that I can parse the DXIL produced by DXC for a simple passthrough shader, but I can't generate the spir-v yet.
Are you using LLVM to parse the DXIL bitcode? I've been able to parse the IL fully that way, but haven't done anything related to codegen.
Most of the (little) time I've spent so far as been coming up with an algorithm to convert DXIL's unstructured control flow to something which conforms to SPIR-V's structured model.
I didn't think that was sufficient progress to wrap into a patch and get feedback on, but if you'd like to see it, I can polish it up and do so.
If you have a repo somewhere it could be interesting to take a look.
Cheers, Hans-Kristian
Greg
On Fri, Oct 18, 2019 at 8:10 AM Hans-Kristian Arntzen <post@arntzen-software.no mailto:post@arntzen-software.no> wrote:
Hi. There's this thread from September (https://www.winehq.org/pipermail/wine-devel/2019-September/150657.html) (Sorry, can't reply to it directly, as I wasn't on the ML at the time). I'd like to dig into DXIL translation, but there is risk of duplicating work. Greg: Got any status update? Cheers, Hans-Kristian
I have not been using LLVM. I was concerned about license conflicts. So I've been writing fresh code based on the LLVM and DXIL documentation.
I'll see about setting up a repo somewhere.
Greg
On Fri, Oct 18, 2019 at 8:21 AM Hans-Kristian Arntzen < post@arntzen-software.no> wrote:
On 10/18/19 4:15 PM, Greg Roth wrote:
I confess I got a bit sidelined on this by some other projects, but I'm at a point where I can take it up again.
The status is that I can parse the DXIL produced by DXC for a simple passthrough shader, but I can't generate the spir-v yet.
Are you using LLVM to parse the DXIL bitcode? I've been able to parse the IL fully that way, but haven't done anything related to codegen.
Most of the (little) time I've spent so far as been coming up with an algorithm to convert DXIL's unstructured control flow to something which conforms to SPIR-V's structured model.
I didn't think that was sufficient progress to wrap into a patch and get feedback on, but if you'd like to see it, I can polish it up and do so.
If you have a repo somewhere it could be interesting to take a look.
Cheers, Hans-Kristian
Greg
On Fri, Oct 18, 2019 at 8:10 AM Hans-Kristian Arntzen < post@arntzen-software.no> wrote:
Hi. There's this thread from September (https://www.winehq.org/pipermail/wine-devel/2019-September/150657.html) (Sorry, can't reply to it directly, as I wasn't on the ML at the time). I'd like to dig into DXIL translation, but there is risk of duplicating work.
Greg: Got any status update?
Cheers, Hans-Kristian
On Fri, 18 Oct 2019 at 17:51, Hans-Kristian Arntzen post@arntzen-software.no wrote:
Most of the (little) time I've spent so far as been coming up with an algorithm to convert DXIL's unstructured control flow to something which conforms to SPIR-V's structured model.
I may be missing something, but the existing vkd3d-shader code already needs to take care of that (vkd3d_dxbc_compiler_emit_control_flow_instruction() in particular), since both TPF and the (very thin) vkd3d-shader IR are unstructured as well.
On 10/18/19 4:32 PM, Henri Verbeet wrote:
On Fri, 18 Oct 2019 at 17:51, Hans-Kristian Arntzen post@arntzen-software.no wrote:
Most of the (little) time I've spent so far as been coming up with an algorithm to convert DXIL's unstructured control flow to something which conforms to SPIR-V's structured model.
I may be missing something, but the existing vkd3d-shader code already needs to take care of that (vkd3d_dxbc_compiler_emit_control_flow_instruction() in particular), since both TPF and the (very thin) vkd3d-shader IR are unstructured as well.
From what I can tell, the DXBC is structured already, and if/endif and friends are already emitted directly, so there isn't any complex analysis required to convert it to SPIR-V. DXIL is unstructured, i.e., it's a goto soup, but it has to be a reducible CFG at least. I didn't see any implementation for that.
Cheers, Hans-Kristian
On Fri, 18 Oct 2019 at 18:08, Hans-Kristian Arntzen post@arntzen-software.no wrote:
On 10/18/19 4:32 PM, Henri Verbeet wrote:
On Fri, 18 Oct 2019 at 17:51, Hans-Kristian Arntzen post@arntzen-software.no wrote:
Most of the (little) time I've spent so far as been coming up with an algorithm to convert DXIL's unstructured control flow to something which conforms to SPIR-V's structured model.
I may be missing something, but the existing vkd3d-shader code already needs to take care of that (vkd3d_dxbc_compiler_emit_control_flow_instruction() in particular), since both TPF and the (very thin) vkd3d-shader IR are unstructured as well.
From what I can tell, the DXBC is structured already, and if/endif and friends are already emitted directly, so there isn't any complex analysis required to convert it to SPIR-V. DXIL is unstructured, i.e., it's a goto soup, but it has to be a reducible CFG at least. I didn't see any implementation for that.
Right, I wouldn't exactly call TPF structured, but it's not quite unstructured either, and doesn't have goto/jump. I wasn't aware that DXIL did.
Henri
Just to be clear, the control flow structuring problem is something I have addressed, so work on an algorithm that would solve this problem would not be duplicated effort.
Greg
On Fri, Oct 18, 2019 at 8:46 AM Henri Verbeet hverbeet@gmail.com wrote:
On Fri, 18 Oct 2019 at 18:08, Hans-Kristian Arntzen post@arntzen-software.no wrote:
On 10/18/19 4:32 PM, Henri Verbeet wrote:
On Fri, 18 Oct 2019 at 17:51, Hans-Kristian Arntzen post@arntzen-software.no wrote:
Most of the (little) time I've spent so far as been coming up with an
algorithm to convert DXIL's unstructured control flow to something which conforms to SPIR-V's structured model.
I may be missing something, but the existing vkd3d-shader code already needs to take care of that (vkd3d_dxbc_compiler_emit_control_flow_instruction() in particular), since both TPF and the (very thin) vkd3d-shader IR are unstructured as well.
From what I can tell, the DXBC is structured already, and if/endif and friends are already emitted directly, so there isn't any complex analysis required to convert it to SPIR-V. DXIL is unstructured, i.e., it's a goto soup, but it has to be a reducible CFG at least. I didn't see any implementation for that.
Right, I wouldn't exactly call TPF structured, but it's not quite unstructured either, and doesn't have goto/jump. I wasn't aware that DXIL did.
Henri
On 10/18/19 5:02 PM, Greg Roth wrote:
Just to be clear, the control flow structuring problem is something I have addressed, so work on an algorithm that would solve this problem would not be duplicated effort.
I assume a typo here, there's a contradiction.
Cheers, Hans-Kristian
Greg
On Fri, Oct 18, 2019 at 8:46 AM Henri Verbeet <hverbeet@gmail.com mailto:hverbeet@gmail.com> wrote:
On Fri, 18 Oct 2019 at 18:08, Hans-Kristian Arntzen <post@arntzen-software.no <mailto:post@arntzen-software.no>> wrote: > On 10/18/19 4:32 PM, Henri Verbeet wrote: > > On Fri, 18 Oct 2019 at 17:51, Hans-Kristian Arntzen > > <post@arntzen-software.no <mailto:post@arntzen-software.no>> wrote: > >> Most of the (little) time I've spent so far as been coming up with an algorithm to convert DXIL's unstructured control flow to something which conforms to SPIR-V's structured model. > >> > > I may be missing something, but the existing vkd3d-shader code already > > needs to take care of that > > (vkd3d_dxbc_compiler_emit_control_flow_instruction() in particular), > > since both TPF and the (very thin) vkd3d-shader IR are unstructured as > > well. > > From what I can tell, the DXBC is structured already, and if/endif and > friends are already emitted directly, so there isn't any complex > analysis required to convert it to SPIR-V. DXIL is unstructured, i.e., > it's a goto soup, but it has to be a reducible CFG at least. I didn't > see any implementation for that. > Right, I wouldn't exactly call TPF structured, but it's not quite unstructured either, and doesn't have goto/jump. I wasn't aware that DXIL did. Henri
Woops! yeah. sorry about the confusion:
Just to be clear, the control flow structuring problem is *NOT* something I have addressed, so work on an algorithm that would solve this problem would not be duplicated effort.
Greg
On Fri, Oct 18, 2019 at 9:05 AM Hans-Kristian Arntzen < post@arntzen-software.no> wrote:
On 10/18/19 5:02 PM, Greg Roth wrote:
Just to be clear, the control flow structuring problem is something I have addressed, so work on an algorithm that would solve this problem would not be duplicated effort.
I assume a typo here, there's a contradiction.
Cheers, Hans-Kristian
Greg
On Fri, Oct 18, 2019 at 8:46 AM Henri Verbeet hverbeet@gmail.com wrote:
On Fri, 18 Oct 2019 at 18:08, Hans-Kristian Arntzen post@arntzen-software.no wrote:
On 10/18/19 4:32 PM, Henri Verbeet wrote:
On Fri, 18 Oct 2019 at 17:51, Hans-Kristian Arntzen post@arntzen-software.no wrote:
Most of the (little) time I've spent so far as been coming up with
an algorithm to convert DXIL's unstructured control flow to something which conforms to SPIR-V's structured model.
I may be missing something, but the existing vkd3d-shader code already needs to take care of that (vkd3d_dxbc_compiler_emit_control_flow_instruction() in particular), since both TPF and the (very thin) vkd3d-shader IR are unstructured as well.
From what I can tell, the DXBC is structured already, and if/endif and friends are already emitted directly, so there isn't any complex analysis required to convert it to SPIR-V. DXIL is unstructured, i.e., it's a goto soup, but it has to be a reducible CFG at least. I didn't see any implementation for that.
Right, I wouldn't exactly call TPF structured, but it's not quite unstructured either, and doesn't have goto/jump. I wasn't aware that DXIL did.
Henri
Cool. I'll work on that then and keep the ML posted on progress. Whatever solution I come up with should be easily reusable into codegen later.
Cheers, Hans-Kristian
On 10/18/19 5:10 PM, Greg Roth wrote:
Woops! yeah. sorry about the confusion:
Just to be clear, the control flow structuring problem is *NOT* something I have addressed, so work on an algorithm that would solve this problem would not be duplicated effort.
Greg
On Fri, Oct 18, 2019 at 9:05 AM Hans-Kristian Arntzen <post@arntzen-software.no mailto:post@arntzen-software.no> wrote:
On 10/18/19 5:02 PM, Greg Roth wrote:
Just to be clear, the control flow structuring problem is something I have addressed, so work on an algorithm that would solve this problem would not be duplicated effort.
I assume a typo here, there's a contradiction. Cheers, Hans-Kristian
Greg On Fri, Oct 18, 2019 at 8:46 AM Henri Verbeet <hverbeet@gmail.com <mailto:hverbeet@gmail.com>> wrote: On Fri, 18 Oct 2019 at 18:08, Hans-Kristian Arntzen <post@arntzen-software.no <mailto:post@arntzen-software.no>> wrote: > On 10/18/19 4:32 PM, Henri Verbeet wrote: > > On Fri, 18 Oct 2019 at 17:51, Hans-Kristian Arntzen > > <post@arntzen-software.no <mailto:post@arntzen-software.no>> wrote: > >> Most of the (little) time I've spent so far as been coming up with an algorithm to convert DXIL's unstructured control flow to something which conforms to SPIR-V's structured model. > >> > > I may be missing something, but the existing vkd3d-shader code already > > needs to take care of that > > (vkd3d_dxbc_compiler_emit_control_flow_instruction() in particular), > > since both TPF and the (very thin) vkd3d-shader IR are unstructured as > > well. > > From what I can tell, the DXBC is structured already, and if/endif and > friends are already emitted directly, so there isn't any complex > analysis required to convert it to SPIR-V. DXIL is unstructured, i.e., > it's a goto soup, but it has to be a reducible CFG at least. I didn't > see any implementation for that. > Right, I wouldn't exactly call TPF structured, but it's not quite unstructured either, and doesn't have goto/jump. I wasn't aware that DXIL did. Henri