LiMiT Userspace Performance Counter Access

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current methods for accessing on-chip performance counters are inefficient, leading to imprecise measurements and high overheads, particularly in parallel programs, due to reliance on heavyweight kernel calls and sampling techniques that interrupt program execution.

Innovation Solution

The Lightweight Microarchitectural Toolkit (LiMiT) enables direct userspace access to Intel's hardware performance counters, allowing precise and low-overhead readings by setting up performance counters for direct access, handling counter overflows, and managing interrupts, resulting in a method that is over 90× faster than PAPI-C and 23× faster than Linux's perf-event.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If kernel calls are used to access performance counters, then measurement precision is improved, but program execution speed deteriorates due to interrupts and overhead

Engineering Contradiction:
Improveperformance counter measurement precisionVSAvoidprogram execution speed
Core Design Contradiction:
Measurement precisionVSSpeed

Solution Approach 1:

The patent extracts the performance counter access functionality from kernel space to user space by providing direct user-accessible registers and instructions for reading performance counters without requiring kernel mode transitions. This eliminates the overhead of context switches and kernel mode changes while maintaining measurement accuracy.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent introduces an intermediary mechanism in the form of dedicated performance monitor registers and instructions that allow user space programs to directly access performance counter data. This intermediary layer provides a controlled interface that maintains measurement precision while avoiding the performance penalty of full kernel mode transitions.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Speed

If sampling techniques are used to reduce overhead, then program execution speed is improved, but measurement precision deteriorates due to missed events

Engineering Contradiction:
Improveprogram execution speedVSAvoidperformance counter measurement precision
Core Design Contradiction:
SpeedVSMeasurement precision

Solution Approach 1:

The patent enables continuous monitoring of performance events by providing always-on performance counter hardware that accumulates event data without interruption. User space programs can read this continuous data stream at any time without needing to sample periodically, thus maintaining both continuous measurement capability and low overhead.

Inventive Principle:
Principle #20Continuity of useful action

Solution Approach 2:

The patent performs preliminary action by pre-configuring performance counter registers and event filters before program execution begins. This allows the hardware to continuously track and accumulate performance data in preparation for user space reads, eliminating the need for runtime sampling and extrapolation that causes precision loss.

Inventive Principle:
Principle #10Preliminary action

3Reliability

If all performance counters are accessible only in privileged mode, then security and control are improved, but device complexity and overhead increase

Engineering Contradiction:
Improvesystem control and securityVSAvoidaccess mechanism complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent segments the performance counter access interface into two distinct parts: privileged mode for configuration and control, and user mode for reading data. This segmentation allows the system to maintain security and control in privileged mode while providing simplified, low-overhead access to performance data in user mode through dedicated registers and instructions.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS8855970B2System and methods for precise microprocessor event counting
Publication Date: 2014.10.07 THE TRUSTEES OF COLUMBIA UNIV IN THE CITY OF NEW YORK
  • US8855970B2 patent drawing
  • US8855970B2 patent drawing
  • US8855970B2 patent drawing

AI summary

Method for providing precise microprocessor performance counter readings including detecting a swap back to a monitored process executing in a microprocessor. In response to the detected swap back to the monitored process, if the value read from the performance counter does not exceed the defined overflow threshold, the value of the performance counter stored in the first memory location is restored to the performance counter. If the value read from the performance counter exceeds the defined overflow threshold, the performance counter is set to zero and the value of the performance counter stored in the first memory location is used to increment an overflow memory location. If the value read from the performance counter exceeds the defined overflow threshold, at least one performance counter reading instruction is detected and in response to the detected at least one performance counter reading instruction, setting the counter output register to zero.