IP Library › Granted Patent US 12,340,302
Granted Patent B2
US 12,340,302 · App. 17/141,895 · Granted Jun 24, 2025

Method and system for microarchitecture-aware program sampling

Inventors: Yuanwei Fang (Sunnyvale, CA); Minghai Qin (Fremont, CA); Yen-kuang Chen (Palo Alto, CA)
Assignee: ALIBABA GROUP HOLDING LIMITED
G06N3/08
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,340,302
App. No.
17/141,895
Granted
Jun 24, 2025
Kind
B2
Abstract

This application describes methods, systems, and apparatus, including computer programs encoded on computer storage media, for microarchitecture-aware program sampling. An exemplary method includes receiving one or more traces collected from one or more microarchitectures executing a computer program for evaluating hardware configurations; training a machine learning (ML) model with multi-task learning based on the one or more traces as one or more training tasks; generating a plurality of embedded vectors representing the computer program; and updating, based on the trained ML model, the plurality of embedded vectors.

Claims (45)

1. A computer-implemented method for sampling sections of a computer program to evaluate a hardware configuration to be deployed onto a plurality of variant microarchitectures, comprising:

obtaining a plurality of traces collected from executing the computer program on the plurality of variant microarchitectures, wherein the computer program comprises a benchmark program, and each of the plurality of traces includes a plurality of performance measurements associated with one or more labels corresponding to the plurality of variant microarchitectures;

training a machine learning (ML) model with multi-task learning based on the plurality of traces and the one or more labels as one or more training tasks, wherein the ML model comprises an embedding layer trained for embedding microarchitecture-specific features of the plurality of variant microarchitectures into vector representations of the plurality of traces;

compiling the computer program into intermediate code and executable code;

obtaining an execution trace by executing the executable code on a runtime system;

inputting the intermediate code into a graph neural network (GNN) to map the intermediate code into a graph;

generating a plurality of embedded vectors based on (1) the graph and (2) the execution trace, the plurality of embedded vectors corresponding to a plurality of sections of the computer program, wherein the computer program and the plurality of embedded vectors are microarchitecture-agnostic; and

updating, using the embedding layer of the trained ML model, the plurality of embedded vectors by injecting the microarchitecture-specific features of the runtime system into the plurality of embedded vectors as a basis for performing microarchitecture-aware program sampling on the computer program;

sampling the plurality of updated embedded vectors to identify a plurality of sections of the computer program that are corresponding to the plurality of variant microarchitectures; and

returning an indication of the plurality of sections of the computer program to evaluate the hardware configuration to be deployed onto the plurality of variant microarchitectures.

2. The method of claim 1 , wherein the sampling comprises:

obtaining one or more clusters of embedded vectors by performing similarity searching on the plurality of updated embedded vectors; and

sampling at least one updated embedded vectors from each of the one or more clusters.

3. The method of claim 1 , wherein the generating the plurality of embedded vectors representing the computer program is based on basic block vectorization (BBV) or deep neural network (DNN) embedding.

4. The method of claim 1 , wherein the plurality of variant microarchitectures comprises at least one of the followings: server-class CPU, desktop-class CPU, mobile-class CPU, or Internet-of-Things (IoT) CPU.

5. The method of claim 1 , wherein the ML model comprises one or more output layers respectively corresponding to the plurality of variant microarchitectures.

6. The method of claim 5 , wherein an output of the embedding layer is an input of the one or more output layers.

7. The method of claim 1 , wherein the updating, based on the trained ML model, the plurality of embedded vectors comprises:

inputting the plurality of embedded vectors into the trained ML model; and

obtaining the plurality of updated embedded vectors as outputs from the embedding layer.

8. The method of claim 1 , wherein each of the one or more traces comprises one or more performance measures for running the computer program on a corresponding microarchitecture.

9. The method of claim 8 , wherein the one or more performance measures comprise at least one of the followings: cycles per instruction (CPI), cache miss rate, or branch misprediction rate.

10. A system for sampling sections of a computer program to evaluate a hardware configuration to be deployed onto a plurality of variant microarchitectures, the system comprising one or more processors and one or more non-transitory computer-readable memories coupled to the one or more processors, the one or more non-transitory computer-readable memories storing instructions that, when executed by the one or more processors, cause the system to perform operations comprising:

obtaining a plurality of traces collected from executing the computer program on the plurality of variant microarchitectures, wherein the computer program comprises a benchmark program, and each of the plurality of traces includes a plurality of performance measurements associated with one or more labels corresponding to the plurality of variant microarchitectures;

training a machine learning (ML) model with multi-task learning based on the plurality of traces and the one or more labels as one or more training tasks, wherein the ML model comprises an embedding layer trained for embedding microarchitecture-specific features of the plurality of variant microarchitectures into vector representations of the plurality of traces;

compiling the computer program into intermediate code and executable code;

obtaining an execution trace by executing the executable code on a runtime system;

inputting the intermediate code into a graph neural network (GNN) to map the intermediate code into a graph;

generating a plurality of embedded vectors based on (1) the graph and (2) the execution trace, the plurality of embedded vectors corresponding to a plurality of sections of the computer program, wherein the computer program and the plurality of embedded vectors are microarchitecture-agnostic; and

updating, using the embedding layer of the trained ML model, the plurality of embedded vectors by injecting the microarchitecture-specific features of the runtime system into the plurality of embedded vectors as a basis for performing microarchitecture-aware program sampling on the computer program;

sampling the plurality of updated embedded vectors to identify a plurality of sections of the computer program that are corresponding to the plurality of variant microarchitectures; and

returning an indication of the plurality of sections of the computer program to evaluate the hardware configuration to be deployed onto the plurality of variant microarchitectures.

11. The system of claim 10 , wherein the sampling comprises:

obtaining one or more clusters of embedded vectors by performing similarity searching on the plurality of updated embedded vectors; and

sampling at least one updated embedded vectors from each of the one or more clusters.

12. A non-transitory computer-readable storage medium for sampling sections of a computer program to evaluate a hardware configuration to be deployed onto a plurality of variant microarchitectures, the storage medium configured with instructions executable by one or more processors to cause the one or more processors to perform operations comprising:

obtaining a plurality of traces collected from executing the computer program on the plurality of variant microarchitectures, wherein the computer program comprises a benchmark program, and each of the plurality of traces includes a plurality of performance measurements associated with one or more labels corresponding to the plurality of variant microarchitectures;

training a machine learning (ML) model with multi-task learning based on the plurality of traces as one or more training tasks, wherein the ML model comprises an embedding layer trained for embedding microarchitecture-specific features of the plurality of variant microarchitectures into vector representations of the plurality of traces;

compiling the computer program into intermediate code and executable code;

obtaining an execution trace by executing the executable code on a runtime system;

inputting the intermediate code into a graph neural network (GNN) to map the intermediate code into a graph;

generating a plurality of embedded vectors based on (1) the graph and (2) the execution trace, the plurality of embedded vectors corresponding to a plurality of sections of the computer program, wherein the computer program and the plurality of embedded vectors are microarchitecture-agnostic; and

updating, using the embedding layer of the trained ML model, the plurality of embedded vectors by injecting the microarchitecture-specific features of the runtime system into the plurality of embedded vectors as a basis for performing microarchitecture-aware program sampling on the computer program;

sampling the plurality of updated embedded vectors to identify a plurality of sections of the computer program that are corresponding to the plurality of variant microarchitectures; and

returning an indication of the plurality of sections of the computer program to evaluate the hardware configuration to be deployed onto the plurality of variant microarchitectures.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 5, 2021
From: FANG, YUANWEI; QIN, MINGHAI; CHEN, YEN-KUANG
To: ALIBABA GROUP HOLDING LIMITED
Reel/Frame 054818/0182 →
Continuity (1)
Related Publication 20220215241A1 · Jul 7, 2022
References Cited (30)
US 8104000B2 · Bjesse · 2012 [cited by applicant]
US 8266570B2 · Walker et al. · 2012 [cited by applicant]
US 8364998B2 · Hsu et al. · 2013 [cited by applicant]
US 8863052B1 · Dhuria et al. · 2014 [cited by applicant]
US 9208053B2 · Kejariwal et al. · 2015 [cited by applicant]
US 9300523B2 · Alone et al. · 2016 [cited by applicant]
US 9361102B2 · Tan et al. · 2016 [cited by applicant]
US 9413527B2 · Yang et al. · 2016 [cited by applicant]
US 10459877B2 · Uliel et al. · 2019 [cited by applicant]
US 10482355B2 · Heifets et al. · 2019 [cited by applicant]
US 10496643B2 · Kandula et al. · 2019 [cited by applicant]
US 20070219646A1 · Oslake et al. · 2007 [cited by applicant]
US 20090276190A1 · Bell, Jr. · 2009 [cited by examiner]
US 20150010143A1 · Yang · 2015 [cited by applicant]
US 20150379183A1 · Odabasi et al. · 2015 [cited by applicant]
US 20160275288A1 · Sethumadhavan et al. · 2016 [cited by applicant]
US 20170052895A1 · Yang et al. · 2017 [cited by applicant]
US 20220044119A1 · Wang · 2022 [cited by examiner]
CN 105740258A · 2016 [cited by applicant]
CN 107590698A · 2018 [cited by applicant]
CN 109583562A · 2019 [cited by applicant]
CN 112435104A · 2021 [cited by applicant]
WO 2019196254A1 · 2019 [cited by applicant]
WO 2020149897A1 · 2020 [cited by applicant]
WO 2020259252A1 · 2020 [cited by applicant]
Wan et al., “Multi-modal Attention Network Learning for Semantic Source Code Retrieval,” 2019 34th IEEE/ACM International Conference on Automated Software Engineering (ASE), San Diego, CA, USA, 2019, pp. 13-25. https://… [cited by examiner]
Ghaffarian et al.,“Neural software vulnerability analysis using rich intermediate graph representations of programs,” Information Sciences 553 (2021), pp. 189-207. https://www.sciencedirect.com/science/article/pii/S0020… [cited by examiner]
Wenisch et al. 2006 (T. F. Wenisch, R. E. Wunderlich, B. Falsafi and J. C. Hoe, “Statistical sampling of microarchitecture simulation,” Proceedings 20th IEEE International Parallel & Distributed Processing Symposium, Rh… [cited by examiner]
First Search for Chinese Application No. 202110499485.3 mailed on May 18, 2023. [cited by applicant]
First Office Action for Chinese Application No. 202111678200.9 mailed on Jan. 13, 2025. [cited by applicant]