This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Adding a throttling threshold to bound dependent tasking memory footprint
Needs ReviewPublic

Authored by rpereira-dev on Aug 21 2023, 5:14 AM.

Details

Reviewers
AndreyChurbanov
jdoerfert
Group Reviewers
Restricted Project
Summary

From "5. Discussions - Task Throttling" of this paper

Task Throttling is a runtime mechanism to reduce tasking operational and memory overheads.
Once at threshold is reached, producer threads stop producing and start consuming tasks instead.

LLVM runtime implements a threshold on (1) the number of ready-tasks per thread.
It was implemented in the context of independent tasking (OpenMP-3.0, 2008), with a motivation being to provide a memory consumption bound.
In the context of dependent tasking (OpenMP-4.0, 2013), this threshold is not sufficient to bound memory consumption: as many (not ready) successor tasks may be created.

This patch introduces a new threshold: (2) the total number of tasks and an environment variable KMP_TASK_MAXIMUM to configure its value (set to 65,536); providing strong warranties on memory consumption.
The patch also adds the KMP_TASK_MAXIMUM_READY to configure the threshold (1) (set to 256).

Few points that came to my mind that may need discussions:

  • a) thresholds default values
  • b) induced overheads: an atomic variable is written by any threads on each task allocation/deallocation - maybe a compile-time option could be added to disabled (2)-throttling entirely preserving the current behavior

If other points come to your mind, please let me know

Diff Detail

Event Timeline

rpereira-dev created this revision.Aug 21 2023, 5:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 21 2023, 5:14 AM
rpereira-dev requested review of this revision.Aug 21 2023, 5:14 AM
Herald added a project: Restricted Project. · View Herald Transcript
rpereira-dev retitled this revision from Adding a throttling threshold to bound dependent tasking memory footprint to [OpenMP] Adding a throttling threshold to bound dependent tasking memory footprint.Aug 23 2023, 12:09 PM

Can you update the patch with context?

Added context with the patch

Few issues in this patch, fixing it, please wait

rpereira-dev updated this revision to Diff 553229.EditedAug 24 2023, 12:29 PM
  • Fixed tests comment that got formatted by previous git clang-format
  • Fixed throttling on the maximum number of tasks per thread; previous version would crash if this was larger than the original queue size: queues are now resizing