Commit Graph

131 Commits

Author SHA1 Message Date
aris theophanidis
8ae2292282 Remove Compression.h from CoreMinimal.h
It's about 1/4 of CoreMinimal.h but rarely needed (Compression.h pulls on CriticalSection.h and Map.h that are costly).
#rb Yoan.StAmant

[CL 30683417 by aris theophanidis in ue5-main branch]
2024-01-18 09:56:55 -05:00
henrik karlsson
68f0c37386 [ShaderCompileWorker]
* Fixed so CrashOutputFile is updated when process is reused (the crash output file should be the same as the output file)

[CL 30643496 by henrik karlsson in ue5-main branch]
2024-01-16 15:39:12 -05:00
steve robb
f3624fbcbc Replaced UE_NORETURN with [[noreturn]].
Replaced PLATFORM_COMPILER_HAS_DECLTYPE_AUTO blocks.
Replaced PLATFORM_COMPILER_HAS_FOLD_EXPRESSIONS blocks.

[CL 30600164 by steve robb in ue5-main branch]
2024-01-12 14:20:07 -05:00
henrik karlsson
9dcc897198 [ShaderWorker]
* Changed so shader worker breaks out of loop when in uba path and no new processes are available

[CL 30588577 by henrik karlsson in ue5-main branch]
2024-01-12 03:10:53 -05:00
henrik karlsson
7530b983ba [ShaderCompiler]
* Fixed function pointer format for getting next process in uba
* Fixed so output files are written even when return code is non-zero (error)

[CL 30585779 by henrik karlsson in ue5-main branch]
2024-01-11 22:48:24 -05:00
henrik karlsson
86e935281a [ShaderCompileWorker]
* Fixed linux compile error

[CL 30525276 by henrik karlsson in ue5-main branch]
2024-01-10 00:23:22 -05:00
henrik karlsson
6b496d4409 [ShaderCompileWorker]
* Removed code checking if worker is running remotely. local and remote should be treated the same way

[CL 30525050 by henrik karlsson in ue5-main branch]
2024-01-09 23:58:03 -05:00
henrik karlsson
b010b4fb61 [ShaderCompileWorker]
* Fixed so WorkingDirectory is updated when new process is fetched

[CL 30513491 by henrik karlsson in ue5-main branch]
2024-01-09 14:50:53 -05:00
henrik karlsson
fd57caf2b8 [ShaderCompileWorker]
* Changed so when building through uba we don't delete the .in file. Since uba supports rescheduling when remote helpers disconnect we can't delete this file until out is fully sent back

[CL 30468743 by henrik karlsson in ue5-main branch]
2024-01-04 12:58:22 -05:00
henrik karlsson
5f84d2d3ed [ShaderCompileWorker]
* Added support for process reuse when running through uba

[CL 30462458 by henrik karlsson in ue5-main branch]
2024-01-02 18:50:42 -05:00
dan elksnitis
cc7c2c54f4 [shaders] shader format preprocessing cleanup & refactoring
- move uniform buffer cleanup and dead stripping into ShaderPreprocessor module's PreprocessShader function
- add "required symbols" to compiler input struct to specify additional symbols to keep during minification aside from those specified by the entrypoint; modify API such that both an entry point string and additional symbols can be specified (to avoid each backend needing to manually parse the compound RT entry point string)
- make use of ModifyShaderCompilerInput in all backends to set additional defines and required symbols on input struct up front; only use the AdditionalDefines map in cases where it's actually necessary
- remove the various per-platform defines for enabling minifier, no longer required now that this has been rolled out for all backends
- fix SCW directcompile mode; this had rotted due to pieces of the FShaderCompilerEnvironment having been added that weren't explicitly serialized to either cmdline or in the shader source. this now serializes as a base64 string written inside the USF containing all portions of the environment required for compilation (using the same serialization function as is used to write/read the SCW input file)
- use a debug flag for indicating we're in "direct compile" mode and should load the debug USF off disk, rather than the poorly named "bSkipPreprocessedCache" (this name is both inaccurate and also confusing due to the addition of the preprocessed job cache)
- modify platform "force wave32" mechanism to use a pragma directive to set a compiler define, instead of doing string replacement in the preprocessed source
- add a view version of the RT entrypoint parsing to use in preprocessing, note that other paths still need to construct fstrings due to further manipulation so keeping the FString path around too
- clean up backends manually checking the "directcompile" cmdline arg

#rb christopher.waters, Yuriy.ODonnell
#rb Chris.Waters
#rb Laura.Hermanns

[CL 30023082 by dan elksnitis in ue5-main branch]
2023-11-30 15:56:34 -05:00
christopher waters
c5ec7d582e Adding -NumJobs=N argument to SCW to facilitate in profiling. This argument causes the compiler to run the processing loop at most N times.
#rb jason.nadro

[CL 28494697 by christopher waters in ue5-main branch]
2023-10-05 08:23:51 -04:00
jason hoerner
046ace59ff ShaderCompiler: Preprocessor optimizations, first pass. Saves 16.7% overall on ConditionalPreprocessShader.
* Inline array memory allocation added to low level preprocessor for output and various temporary buffers to reduce dynamic memory allocation and reallocation overhead.  Saved 4.6%.
* FShaderPreprocessOutput::StripCode optimized to write to FString as TCHAR array, rather than using AppendChar (over 4x speedup).  Saved 2.9%
* Shader source file cache now also stores stripped and ANSI converted source, to avoid need to convert and strip the source, plus allocating a copy is avoided.  Saved 4.3%
* Uniform buffer structure declarations stored as ANSI converted source, avoiding convert and copy.  Saved 4.9%

#rnx
#rb dan.elksnitis jason.nadro

[CL 28219741 by jason hoerner in ue5-main branch]
2023-09-26 05:29:05 -04:00
laura hermanns
c97a8c7224 Add "-DebugInfoPath=PATH" argument to SCW to allow dumping debug info with -directcompile commandlet.
#rb Jason.Nadro
#rnx

[CL 27359244 by laura hermanns in ue5-main branch]
2023-08-24 17:18:49 -04:00
dan elksnitis
5c00384f67 [shaders]
- Remove the condition causing SCW to automatically exit after a single job if HLSLcc was used. This doesn't appear to be beneficial; HLSLcc uses a lot of memory but does not appear to leak it, so we're wasting time spinning up new processes unnecessarily here. This allows us to deprecated the associated field in the compiler output and function in IShaderFormat.
- Strip out compiler invocations stats; this was not accurate in some cases and it was decided after discussion that at this point the effort to fix the problems was not worth the utility we get from it.

#rb Jason.Nadro
#rb Laura.Hermanns

[CL 26256933 by dan elksnitis in ue5-main branch]
2023-06-27 10:11:41 -04:00
laura hermanns
33bffd08f6 Add full memory stats to OOM error handler in SCW.
#rb Dan.Elksnitis

[CL 26023492 by laura hermanns in ue5-main branch]
2023-06-15 15:40:49 -04:00
jason hoerner
88d847a0ad GlobalBeginCompileShader optimizations. 3.2x improvement in performance of the function on Lyra cook:
* Early out when adding uniform buffer resource entries, by checking if uniform buffer had been processed, before processing individual entries.
* Changed resource entry list from a map to an array, saving the cost of map operations adding items to it.
* Resource entries for global uniform buffers cached once at startup.
* Resource entry member names stored in an external buffer, to avoid per-entry string memory allocation overhead.
* Miscellaneous smaller optimizations -- for example, using ByHash to avoid redundant hashing and FString construction.

#jira none
#rnx
#rb jason.nadro dan.elksnitis
#preflight 646cfdbc1134ffac7034af60

[CL 25596308 by jason hoerner in ue5-main branch]
2023-05-23 20:16:11 -04:00
dan elksnitis
f645f93588 [shaders] remove legacy preprocessor option & mcpp library
#rb Jason.Nadro
#preflight 6467bf0c2c0a5da0dcd7aaf2
#fyi Yuriy.ODonnell

[CL 25549427 by dan elksnitis in ue5-main branch]
2023-05-19 14:50:25 -04:00
Steve Robb
0f44db07d5 Replaced some container operator new usage.
#rb james.hopkin
#jira none
#preflight 6459670f28155a0f41565a34

[CL 25384456 by Steve Robb in ue5-main branch]
2023-05-09 05:17:49 -04:00
dan elksnitis
b52faed5d5 [shaders]
- add new IShaderFormat API for separate preprocessing and compilation; backends can implement one or the other depending on the return value of SupportsIndependentPreprocessing
- add support for executing preprocessing in the cook process prior to job submission and constructing job input hashes based on preprocessed source (and a subset of the environment used as compile inputs). controlled by a cvar for now and disabled by default
- add a BaseShaderFormat class in ShaderCompilerCommon which implements common behaviour for output of debug data - note this function is only called for formats which support independent preprocessing, so is expected to be used only by formats which have been converted to use this API
- add new cvars for output of some additional shader debug data - 1. a txt file containing the input hash a.k.a. job cache key 2. a text file containing all diagnostic messages (errors and warnings) for the job
- minor change to how input hashes are constructed for pipeline jobs - sum hashes as 256-bit ints instead of adding to a buffer and re-hashing. faster and simpler, and also more collision resistant (sum of two well distributed hashes equally well distributed)

#rb Jason.Nadro
#rb Yuriy.ODonnell
#preflight 64512c88c86798f650b953d3

[CL 25317218 by dan elksnitis in ue5-main branch]
2023-05-03 10:17:48 -04:00
dan elksnitis
2971b65bc4 [shaders] deprecated FShaderPipelineCompileJob::bFailedRemovingUnused field; this is only used to append some dubiously useful information to a log message (the underlying error causing the failure is always reported as any other shader preprocess/compile error). opting to remove rather than dragging this along with forthcoming preprocessing refactoring.
#preflight 6435679c1d61ecec3b56c78d
#rb Jason.Nadro

[CL 24991496 by dan elksnitis in ue5-main branch]
2023-04-11 11:05:47 -04:00
dan elksnitis
b5acd2894d [shaders] unify handling of single job bSucceeded flag; wasn't getting set properly when not using workers (resubmit with pipeline serialization fix)
#rb Yuriy.ODonnell
#rb Laura.Hermanns
#rb Jason.Nadro
#preflight 63d2e011d21dbe1d29be43c1

[CL 23893259 by dan elksnitis in ue5-main branch]
2023-01-27 17:02:08 -05:00
dan elksnitis
017b41a8b3 [Backout] - CL23885168
#fyi dan.elksnitis
Original CL Desc
-----------------------------------------------------------------
[shaders] unify handling of single job bSucceeded flag; wasn't getting set properly when not using workers

#rb Yuriy.ODonnell
#rb Laura.Hermanns
#rb Jason.Nadro
#preflight 63d2e011d21dbe1d29be43c1

[CL 23889694 by dan elksnitis in ue5-main branch]
2023-01-27 14:57:37 -05:00
dan elksnitis
5788613c9d [shaders] unify handling of single job bSucceeded flag; wasn't getting set properly when not using workers
#rb Yuriy.ODonnell
#rb Laura.Hermanns
#rb Jason.Nadro
#preflight 63d2e011d21dbe1d29be43c1

[CL 23885168 by dan elksnitis in ue5-main branch]
2023-01-27 12:04:51 -05:00
dan elksnitis
da802ed74c [shaders]
- move compile job types into RenderCore and use them in SCW
- using the above factor out a helper function for pipeline job compilation to further reduce code duplication
- make flags indicating job success/failure conditions part of the SCW output data rather than evaluating them when reading the output (so they can be evaluated once in the helper function mentioned above)
- modify debug worker input dumps to write a single file for combined-pipeline compilation rather than one file per stage

#rb Yuriy.ODonnell
#preflight 63d1725d574ab9cae4c93d76

[CL 23868225 by dan elksnitis in ue5-main branch]
2023-01-26 10:35:39 -05:00