Skip to content

CKF branch factor limits are applied inconsistently #855

@stephenswat

Description

@stephenswat

The track finding configuration contains two distinct variables that aim to limit the branching factor in the combinatorial Kálmán filter:

/// Maxmimum number of branches per seed
unsigned int max_num_branches_per_seed = 10;
/// Maximum number of branches per surface
unsigned int max_num_branches_per_surface = 10;

In a naive reading, I would assume max_num_branches_per_surface to mean the maximum number of branches per track per surface, while I would assume max_num_branches_per_seed to mean the maximum number of tracks that can branch from a single seed throughout all steps in the CKF. Unfortunately, the reality seems to differ somewhat, and the behaviour also differs between CPU and GPU code.

On the CPU, the max_num_branches_per_seed variable is used to control the track finding (https://github.com/acts-project/traccc/blob/701f55b2000a59e0cce6c0bb31beeeae34b34a50/core/include/traccc/finding/details/find_tracks.hpp) through the use of a n_trks_per_seed array which is incremented whenever we branch on a surface.

On the CPU, the max_num_branches_per_surface variable is used to count the number of branches per surface for each particle, as expected:

if (n_branches > config.max_num_branches_per_surface) {
break;
}

On the GPU, the max_num_branches_per_seed , the use is similar to on the CPU and can be found here:

if (s_pos >= cfg.max_num_branches_per_seed) {
params_liveness[param_id] = 0u;
return;
}

On the GPU, the max_num_branches_per_surface parameter is used only in the product of itself with the number of tracks. Thus, it does not limit the branching factor per track, it only limits the total number of tracks. If one track produces an excessive number of tracks, it will not be stopped by max_num_branches_per_surface if other tracks use less than the quota.

Thus, it seems to me that max_num_branches_per_surface is used to mean different things depending on the platform on which it is used.

But there is a bigger problem which is that the array against which we compare max_num_branches_per_seed is reset at every CKF step. It is reset here for the CPU code:

std::fill(n_trks_per_seed.begin(), n_trks_per_seed.end(), 0u);

And it is reset here in the GPU code:

m_copy.memset(n_tracks_per_seed_buffer, 0)->ignore();

Notice that this resetting happens every CKF step. Therefore, we are limiting the branching per track per surface as you would expect. In actual fact, max_num_branches_per_surface and max_num_branches_per_seed are doing the same thing.

Pinging @beomki-yeo as he wrote this code originally; is this behaviour intended?

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance-relevant changesphysicsPhysics performance monitoringsharedChanges related to shared code

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions