microsoft / microsoft/DirectXShaderCompiler

ftime-trace flag is not respected by the `DxcCompiler3` interface

Open
#6,588 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Description

When using the DxcCompiler3 interface. The compilation argument -ftime-trace is ignored and no DXC_OUT_TIME_TRACE will be produced, same with the -ftime-report flag

Additionally, I should say that -ftime-report unconditionally writing to DXC_OUT_ERRORS is unfortunate and it would be nice if we could prevent it in a future release, just like the -ftime-trace=file allow !

In dxccompilerobj.cpp, the trace flag is only handled by the DxcCompilerAdapter::WrapCompile function. It is used internally by DxcCompilerAdapter::CompileWithDebug, DxcCompilerAdapter::Preprocess and DxcCompilerAdapter::Disassemble but calling IDxcCompiler3::Compile get you straight to DxcCompiler::Compile that has no support for it. The current workaround is to demote our user code from using the v3 interface to the v2 interface in order to compile though the internal adapter.

Steps to Reproduce

Instantiate a DxcCompiler3 in code and use the Compile function to compile a shader with one of the provided argument be -ftime-trace. Then try to query the output DXC_OUT_TIME_TRACE out of the DxcResult object, you will receive a INVALID_ARG error

Environment

  • DXC version 2024_03_29 and latest github source
  • Host Operating System Win11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in dxccompilerobj.cpp, comparing DxcCompilerAdapter::WrapCompile with DxcCompiler::Compile for the DxcCompiler3 path. Reproduce with IDxcCompiler3::Compile and -ftime-trace, then query DXC_OUT_TIME_TRACE; done means the output is produced as it is through the adapter, with -ftime-report behavior considered separately.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.