Improvement introducing batched, precise re-evaluation of candidates in the CELF algorithm
By using a profiler and implementing optimizations during the initial candidate-counting stage of the CELF+heap process, we have managed to accelerate this stage of rulest by ~38%.
Selection (CELF greedy) 13:13 33.6% (620.5 candidates/s)
score calls=533,785 (batched=64,128, singleton=469,657), candidates=2,759,654; wall time=471.294 s; host allocation=2.361 s; host enqueueing=81.524 s; GPU kernel=293.786 s; H2D=0.516 s; filling=7.462 s; readback=2.024 s; wait for synchronization=315.712 s; average time per call=0.88 ms
Selection (CELF greedy) 08:11 24.0% (1,006.0 candidates/s)
score calls=525,423 (batched=88,982, singleton=436,441), candidates=2,833,397; wall time=409.614 s; host allocation=1.458 s; host enqueueing=74.758 s; GPU kernel=303.370 s; H2D=0.502 s; filling=6.669 s; readback=1.039s; synchronization wait=311.601s; avg wall/call=0.78ms
Time saved: 5.02 min
Reduction in stage duration: 38.23%
What has changed
The CELF algorithm continues to use simplified upper bounds (based on raw hits) to discard candidates.
Candidates whose refined upper bounds still allow for a result better than the current best are now evaluated precisely and in batches - using a dedicated bitmap row of target IDs for each candidate.
For the winning candidate, an additional registration scan is performed to retrieve the exact target IDs. The gain obtained this way is verified against the precise gain calculated during the batch process before the coverage state is committed.
The OpenCL compute kernel supports three modes: fast upper-bound estimation, batch calculation of precise gains, and precise evaluation of a single candidate, including hit registration for the winner.
The ProcessEngineProxy component issues the command to use this new precise-counting mode, while maintaining the CELF algorithm's execution on the previously selected single GPU.
The method for allocating the coverage matrix remains unchanged: the full "candidate–target" coverage matrix is not created.
Ability to roll back changes (rollback)
Batch-based, precise re-evaluation of candidates is enabled now by default. To use the legacy CELF-style re-evaluation (rescore) path, you must set this environment variable before running the program.
RULEST_CELF_EXACT_BATCH=0
Please be aware, however, that for a period of 2–5 minutes, the rule processing rate will start/drop to 0 rules per second (depending on the heap load - specifically, how many "dead" candidates with inflated upper bounds caused by duplicates - reside at the top of the heap, ahead of the winning rule).