Skip to content

Write via zip proxies

Olli Lupton requested to merge olupton_write_via_proxies into master

Based on this comment in Rec!2208 (merged), I put together an example of how using the zip/proxy machinery to efficiently fill SOA-style containers. This is Event/EventBase/tests/src/test_ZipWriting.cpp in the diff.

Because I also moved the main zip header to sit alongside the SOACollection header the overall MR diff looks awful, but the real changes are not so large. It might be better to look at individual commits.

cc: @peilian @ahennequ -- any thoughts?

The essence is that something like

auto const added = c.emplace_back<simd>();
added.setI( some_int_v );

generates a plain [contiguous] store to the end of the container, and

auto const added = c.emplace_back<simd>( mask );
added.setI( some_int_v );

generates a compress-store using the given mask.

You end up with various different kinds of proxy objects. I think this is a "zero overhead" way of filling containers in algorithms.

Type Read semantics Write semantics
Compress Disabled Compress-store to offset using mask
Contiguous Contiguous read from offset Contiguous write to given offset
ScalarFill Load a single value from offset and broadcast to int_v Disabled
ScatterGather Gather from an int_v of offsets Scatter to given offsets not implemented

Needs some small changes in Rec!2245 (merged) and Phys!806 (merged).

Edited by Olli Lupton

Merge request reports