Commit Graph

86 Commits

Author SHA1 Message Date
rob krajcarski
a7225d5d7a Fix for member function specialization on android with VectorVM
#rb none


#ROBOMERGE-SOURCE: CL 12310974 via CL 12311084
#ROBOMERGE-BOT: (v670-12295787)

[CL 12311103 by rob krajcarski in Main branch]
2020-03-19 16:30:52 -04:00
rob krajcarski
357a490ebd Add local jump table to VectorVM's optimized byte code to reduce memory footprint (~%30 lower)
#rb stu.mckenna


#ROBOMERGE-SOURCE: CL 12306979 via CL 12306987
#ROBOMERGE-BOT: (v670-12295787)

[CL 12307004 by rob krajcarski in Main branch]
2020-03-19 14:40:42 -04:00
rob krajcarski
5f2b4ebba6 Generates function bindings for external DI functions that don't require user poitners so that we can share them across instances
-changes the function table to be an array of function pointers to allow for the redirection without copies/reallocations
-eliminates 2nd most common allocation in cases with large instance counts in niagara
#rb stu.mckenna


#ROBOMERGE-SOURCE: CL 12146347 via CL 12146348
#ROBOMERGE-BOT: (v659-12123632)

[CL 12146350 by rob krajcarski in Main branch]
2020-03-11 22:27:39 -04:00
arne schober
8ebb9182e7 FNM - Added Compression option for Niagara Systems. Thge Option will try to compress some of the parameters to use half precission, which can be a performance benefit on the GPU and sometimes also on the CPU.
#RB Rob.Krajcarski, Stu.McKenna
#JIRA UE-84463


#ROBOMERGE-OWNER: arne.schober
#ROBOMERGE-AUTHOR: arne.schober
#ROBOMERGE-SOURCE: CL 12105113 via CL 12121713
#ROBOMERGE-BOT: (v657-12064184)

[CL 12121717 by arne schober in Main branch]
2020-03-10 21:00:17 -04:00
mihnea balta
1dacb87178 Fixed particle IDs never being deallocated on CPU (bug introduced in 11290626).
#rb none


#ROBOMERGE-SOURCE: CL 11303717 via CL 11303719
#ROBOMERGE-BOT: (v653-11302973)

[CL 11303721 by mihnea balta in Main branch]
2020-02-10 10:20:18 -05:00
mihnea balta
6c7931e56b Fixed stale entries in the ID to index buffers for CPU emitters.
The code used to update the output ID to index table, but that left stale entries in the input buffer set. When particles died, one of the buffers had -1 for the dead IDs, but the other still had the old execution indexes. This could lead to direct reads returning bogus data, instead of reporting that the ID is no longer in use. The solution is to clear the ID table at the beginning of the tick, and let the UpdateID() function fill in the IDs which are still in use.

This problem didn't occur on GPU, where the tables were already being cleared.

#rb none


#ROBOMERGE-SOURCE: CL 11292467 via CL 11292468
#ROBOMERGE-BOT: (v647-11244347)

[CL 11293007 by mihnea balta in Main branch]
2020-02-07 13:07:57 -05:00
mihnea balta
dd1264d2a4 Fixed incorrect ID to index mapping on CPU when an emitter spawns additional particles.
The UpdateID CPU kernel didn't take into account the instance start offset, so the spawn step mapped new IDs to indices starting at 0. If the emitter already contained particles, this caused the ID to index mapping to be incorrect in the frame when the spawn happened, which caused further problems if another emitter tried to read the particles in that frame.

#rb none


#ROBOMERGE-SOURCE: CL 11290626 via CL 11290627
#ROBOMERGE-BOT: (v647-11244347)

[CL 11290628 by mihnea balta in Main branch]
2020-02-07 06:53:49 -05:00
mihnea balta
ff43248d11 Particle read DI:
* added functions which can retrieve the IDs of the particles spawned in the last tick
* added missing barriers on source buffers when reading from another emitter
* fixed bug when more than one DI function was used in a module (bad alignment on the elements of the array of attribute indices)

Persistent IDs:
* replaced ClearUAV with a custom shader, so we can set sane barriers instead of the stuff that ClearUAV() forces. Dev-Rendering replaced ClearUAV() with a better API, but I didn't want to wait for that merge.
* grouped together all the ID buffer clears before the simulation dispatches, and all the free ID list updates after rendering, so they can overlap and to avoid stalls

Barriers:
* fixed a bogus compute to graphics transition on the ID to index buffer
* when running multiple ticks, only the outputs of the final tick are transitioned to graphics
* automatic CS cache flushes are disabled once before running all the ticks and enabled at the end, instead of doing it for each tick

#jira UE-84717
#rb Stu.McKenna


#ROBOMERGE-OWNER: mihnea.balta
#ROBOMERGE-AUTHOR: mihnea.balta
#ROBOMERGE-SOURCE: CL 11163241 via CL 11163243
#ROBOMERGE-BOT: (v640-11091645)

[CL 11167081 by mihnea balta in Main branch]
2020-01-29 15:31:45 -05:00
rob krajcarski
c5f7899345 Adds a set of constant buffers to hold engine driven niagara variables so that we can reduce the cost of managing the parameters through the script execution pipeline
-reduces fixed concurrent CPU costs of emitters by about 15%
-emitter parameter storage remains in place for non-system parameters
#rb stu.mckenna, simon.tovey


#ROBOMERGE-OWNER: rob.krajcarski
#ROBOMERGE-AUTHOR: rob.krajcarski
#ROBOMERGE-SOURCE: CL 11082540 via CL 11082550
#ROBOMERGE-BOT: (v637-11041722)

[CL 11082603 by rob krajcarski in Main branch]
2020-01-22 10:22:18 -05:00
stu mckenna
5a1902f295 - Ensure we don't accidentally read from the constant table when optimizing stat calls inside the VectorVM
- If the compiler chooses to fold both the Optimize & regular VM function calls together we will read garbage

#rb joe.barnes,ben.woodhouse
#rnx


#ROBOMERGE-OWNER: stu.mckenna
#ROBOMERGE-AUTHOR: stu.mckenna
#ROBOMERGE-SOURCE: CL 10907287 via CL 10907300 via CL 10907449 via CL 10907456 via CL 10907462
#ROBOMERGE-BOT: (v626-10872990)

[CL 10907468 by stu mckenna in Main branch]
2020-01-08 14:49:48 -05:00
ryan durand
0f0464a30e Updating copyright for Engine Runtime.
#rnx
#rb none


#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900
#ROBOMERGE-BOT: (v613-10869866)

[CL 10870549 by ryan durand in Main branch]
2019-12-26 14:45:42 -05:00
rob krajcarski
43c07bf080 Fix for vector writes crossing batch boundaries in VectorVM with batched outputs
#rb simon.tovey


#ROBOMERGE-SOURCE: CL 10798049 via CL 10798059
#ROBOMERGE-BOT: (v610-10636431)

[CL 10798061 by rob krajcarski in Main branch]
2019-12-18 12:01:16 -05:00
stu mckenna
45b407eb5e - Enable optimized VM code by default
- Fallback to synchronous optimizing when free is enabled so that we can free the source until I figure out a safe way to do this

[FYI] shaun.kime,simon.tovey,rob.krajcarski
#rnx


#ROBOMERGE-SOURCE: CL 10667538 via CL 10668398 via CL 10668414
#ROBOMERGE-BOT: (v609-10634694)

[CL 10668428 by stu mckenna in Main branch]
2019-12-11 23:55:24 -05:00
stu mckenna
891cc8b780 - Generate optimized VM ByteCode async
[CODEREVIEW] simon.tovey,rob.krajcarski
#rnx


#ROBOMERGE-SOURCE: CL 10621008 via CL 10621900 via CL 10621993
#ROBOMERGE-BOT: (v608-10590470)

[CL 10622045 by stu mckenna in Main branch]
2019-12-09 16:28:14 -05:00
rob krajcarski
ac25478aa1 Optimization to the VectorVM pattern of acquiring indices and outputting stream of attribute data.
Left packs the data with shuffles instead of branching on if a particle is valid, and claims blocks of indices rather than one at a time.
VectorIntShuffle intrinsic has been added locally to the VectorVM and is only included for selected platforms
#rb stu.mckenna, simon.tovey


#ROBOMERGE-SOURCE: CL 10594706 via CL 10594709
#ROBOMERGE-BOT: (v607-10590470)

[CL 10594712 by rob krajcarski in Main branch]
2019-12-06 13:41:14 -05:00
rob krajcarski
9903fc14f4 Back out changelist 10593082
#rb None


#ROBOMERGE-SOURCE: CL 10593938 via CL 10593945
#ROBOMERGE-BOT: (v607-10590470)

[CL 10593947 by rob krajcarski in Main branch]
2019-12-06 12:37:57 -05:00
rob krajcarski
f907fec87c Optimization to the VectorVM pattern of acquiring indices and outputting stream of attribute data.
Left packs the data with shuffles instead of branching on if a particle is valid, and claims blocks of indices rather than one at a time.
#rb stu.mckenna, simon.tovey


#ROBOMERGE-SOURCE: CL 10593082 via CL 10593089
#ROBOMERGE-BOT: (v607-10590470)

[CL 10593090 by rob krajcarski in Main branch]
2019-12-06 11:26:55 -05:00
rob krajcarski
941e82a956 Cherry pick SseMath changes (10103273 & 10114181), and also move VMVector over to use it (as well as create safe versions to protect against div/0 issues)
#rb stu.mckenna

#ushell-cherrypick of 10103273 by john.hable
#ushell-cherrypick of 10114181 by john.hable


#ROBOMERGE-SOURCE: CL 10481339 via CL 10481342
#ROBOMERGE-BOT: (v605-10478255)

[CL 10481343 by rob krajcarski in Main branch]
2019-11-30 15:58:53 -05:00
stu mckenna
746ee72100 - Fix for static analysis warning
- Warning is because a compare flags against a uint32 value and it assumes you should be doing an & == v which isn't correct in this instance

#rb none
#jira UE-83124
#rnx


#ROBOMERGE-SOURCE: CL 10034568 via CL 10034570
#ROBOMERGE-BOT: (v565-10026848)

[CL 10034571 by stu mckenna in Main branch]
2019-11-05 18:22:19 -05:00
stu mckenna
7d21538025 - Fix static analysis warning
#jira UE-83124
#rb none
#rnx


#ROBOMERGE-SOURCE: CL 10017401 via CL 10017403
#ROBOMERGE-BOT: (v562-10004402)

[CL 10017405 by stu mckenna in Main branch]
2019-11-05 12:55:06 -05:00
stu mckenna
087fd80d15 - Fix some static analysis warnings
[FYI] marc.audy
#rnx


#ROBOMERGE-SOURCE: CL 9975688 via CL 9975689
#ROBOMERGE-BOT: (v560-9963197)

[CL 9975690 by stu mckenna in Main branch]
2019-11-04 18:29:26 -05:00
stu mckenna
b6010254ab - Write VectorVM code in LittleEndian as opposed to BigEndian, this avoids runtime byte swapping
- Read ByteCode directly if unalgned loads are supported to condense 3 opts into 1 when reading a uint16
- Pre-calculate instance loops for VECTOR_WIDTH_FLOATS to avoid each vector op having to round / divide instance counts
- Added runtime optimization of the VM script, this currently boils down to a function call per VM invoke + storing the data required
- Use vm.OptimizeVMByteCode to enable optimized code generation
- Use vm.UseOptimizedVMByteCode to enable running optimized code rather the traditional byte code

[FYI] simon.tovey,rob.krajcarski,shaun.kime
#rnx


#ROBOMERGE-SOURCE: CL 9962648 via CL 9964955
#ROBOMERGE-BOT: (v560-9963197)

[CL 9965540 by stu mckenna in Main branch]
2019-11-03 14:40:53 -05:00
simon tovey
6e2874c958 - Removing a bunch of setup work we do for VM exectuion with remapping of register tables.
- VM is now directly fed a set of pre generated register tables from the datasets.
- Split the monolithic register table in the VM up so there are explicit I/O and temp register tables the script indexes into directly.
- Avoids some recreation of expensve objects in favour of manual reset calls.
- Re-wrote Oupt kernel to be more explicit. Going via templated handler in this case didn't get us any code reuse and just obfuscated it's workings.

Saves ~10-25us of overhead per VM involcation which soon adds up.
Saves ~1-2us inside each VM exec itself.

#rb Stu.Mckenna


#ROBOMERGE-SOURCE: CL 9743796 via CL 9743798
#ROBOMERGE-BOT: (v542-9736015)

[CL 9745804 by simon tovey in Main branch]
2019-10-22 11:10:29 -04:00
simon tovey
1f28bf6921 Made VM context TLS again as the pooled version was causing a perf issue.
#rb none
[FYI] shaun.kime, arne.shober


#ROBOMERGE-SOURCE: CL 9031014 via CL 9042170 via CL 9042350
#ROBOMERGE-BOT: (v443-9013191)

[CL 9042481 by simon tovey in Main branch]
2019-09-24 13:10:00 -04:00
simon tovey
c1a674c709 - Storing compact form of databuffer layout in single array to reduce cache misses in register setup.
- Optimizing temp register layout for better cache usage.
- Moving VM context from TLS to pool.

#rb Stu.Mckenna, Shaun.Kime


#ROBOMERGE-OWNER: simon.tovey
#ROBOMERGE-AUTHOR: simon.tovey
#ROBOMERGE-SOURCE: CL 8886792 via CL 8886955 via CL 8889429
#ROBOMERGE-BOT: (v427-8887818)

[CL 8890014 by simon tovey in Main branch]
2019-09-19 12:36:11 -04:00