Skip to content

Commit

Permalink
Create constants, interface and child analysis components for Rooflin…
Browse files Browse the repository at this point in the history
…e Model

PiperOrigin-RevId: 698554594
  • Loading branch information
zzzaries authored and copybara-github committed Nov 27, 2024
1 parent 94b92ef commit 7b5c356
Show file tree
Hide file tree
Showing 26 changed files with 1,462 additions and 0 deletions.
7 changes: 7 additions & 0 deletions frontend/app/common/constants/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ ts_library(
],
)

ts_library(
name = "roofline_model_constants",
srcs = [
"roofline_model_constants.ts",
],
)

ts_library(
name = "testing",
srcs = [
Expand Down
250 changes: 250 additions & 0 deletions frontend/app/common/constants/roofline_model_constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
/**
* color palette for roofline model pie chart
*/
export const PIE_CHART_PALETTE = [
'#3366CC', '#FF9900', '#109618', '#990099', '#3B3EAC', '#0099C6', '#DD4477',
'#66AA00', '#B82E2E', '#316395', '#994499', '#22AA99', '#AAAA11', '#6633CC',
'#E67300', '#8B0707', '#329262', '#5574A6', '#3B3EAC',
];

/** axis boundary for roofline model scatter chart */
export const SCATTER_CHART_AXIS = {
minX: 0.00001,
maxX: 100000,
minY: 0.00001,
maxY: 1000000,
};

/** scatter base options for roofline chart */
export const SCATTER_CHART_OPTIONS = {
title: 'Roofline Model',
width: 720,
height: 400,
hAxis: {
title: 'FLOP/Byte (log scale)',
scaleType: 'log',
viewWindow: {
min: SCATTER_CHART_AXIS.minX,
max: SCATTER_CHART_AXIS.maxX,
},
// Ticks have to be explicitly defined for scaling axis evenly.
ticks: [
0,
0.00001,
0.0001,
0.001,
0.01,
0.1,
1,
10,
100,
1000,
10000,
100000,
],
},
vAxis: {
title: 'GFLOP/s (log scale)',
scaleType: 'log',
viewWindow: {
min: SCATTER_CHART_AXIS.minY,
max: SCATTER_CHART_AXIS.maxY,
},
// Ticks have to be explicitly defined for scaling axis evenly.
ticks: [0, 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000, 100000, 1000000],
},
legend: {position: 'right'},
tooltip: {isHtml: true},
// Be mindful that series is not specified here, otherwise the shallow copy in
// components of this object could result in overwritten series styles
};

/** roofline plot line styles */
export const ROOFLINE_STYLES = {
read: {
lineWidth: 1,
color: 'red',
pointsVisible: false,
},
write: {
lineWidth: 1,
color: 'green',
pointsVisible: false,
},
hbm: {
lineWidth: 1,
color: 'black',
pointsVisible: false,
},
};

/** roofline model properties configuration */
export const DEVICE_INFO = [
{
id: 'device_type',
label: 'Device Type',
type: 'string',
display: true,
},
{
id: 'megacore',
label: 'Megacore',
type: 'string',
context: '',
display: true,
},
{
id: 'peak_flop_rate',
label: 'Peak FLOP Rate per TensorCore',
type: 'number',
unit: 'GFLOP/s',
display: true,
},
{
id: 'peak_hbm_bw',
label: 'Peak HBM Bandwidth per TensorCore',
type: 'number',
unit: 'GiB/s',
context: '',
display: true,
},
{
id: 'peak_vmem_read_bw',
label: 'Peak VMEM Read Bandwidth per TensorCore',
type: 'number',
unit: 'GiB/s',
display: true,
},
{
id: 'peak_vmem_write_bw',
label: 'Peak VMEM Write Bandwidth per TensorCore',
type: 'number',
unit: 'GiB/s',
display: true,
},
{
id: 'peak_cmem_read_bw',
label: 'Peak CMEM Read Bandwidth per TensorCore',
type: 'number',
unit: 'GiB/s',
display: true,
},
{
id: 'peak_cmem_write_bw',
label: 'Peak CMEM Write Bandwidth per TensorCore',
type: 'number',
unit: 'GiB/s',
display: true,
},
{
id: 'cmem_write_ridge_point',
label: 'CMEM Write Ridge Point',
type: 'number',
unit: 'Flop/byte',
display: false,
},
{
id: 'cmem_read_ridge_point',
label: 'CMEM Read Ridge Point',
type: 'number',
unit: 'Flop/byte',
display: false,
},
{
id: 'vmem_write_ridge_point',
label: 'VMEM Write Ridge Point',
type: 'number',
unit: 'Flop/byte',
display: false,
},
{
id: 'vmem_read_ridge_point',
label: 'VMEM Read Ridge Point',
type: 'number',
unit: 'Flop/byte',
display: false,
},
{
id: 'hbm_ridge_point',
label: 'HBM Ridge Point',
type: 'number',
unit: 'Flop/byte',
display: false,
},
];

/**
* numeric data display formatting config
* might be feasible to be passed through api response data
*/
export const NUMERIC_DATA_FORMAT:
{[key: string]: {type: string; digit?: number};} = {
'total_time_per_core': {
type: 'decimal',
digit: 0,
},
'total_time': {
type: 'decimal',
digit: 2,
},
'avg_time': {
type: 'decimal',
digit: 2,
},
'total_self_time': {
type: 'decimal',
digit: 2,
},
'avg_self_time': {
type: 'decimal',
digit: 2,
},
'measured_flop_rate': {
type: 'decimal',
digit: 2,
},
'measured_memory_bw': {
type: 'decimal',
digit: 2,
},
'hbm_bw': {
type: 'decimal',
digit: 2,
},
'cmem_read_bw': {
type: 'decimal',
digit: 2,
},
'cmem_write_bw': {
type: 'decimal',
digit: 2,
},
'operational_intensity': {
type: 'decimal',
digit: 2,
},
'total_self_time_percent': {
type: 'percent',
digit: 1,
},
'cumulative_total_self_time_percent': {
type: 'percent',
digit: 1,
},
'dma_stall_percent': {
type: 'percent',
digit: 1,
},
'roofline_efficiency': {
type: 'percent',
digit: 1,
},
'compute_efficiency': {
type: 'percent',
digit: 1,
},
'max_mem_bw_utilization': {
type: 'percent',
digit: 1,
},
};
25 changes: 25 additions & 0 deletions frontend/app/common/interfaces/roofline_model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {SimpleDataTable,} from 'org_xprof/frontend/app/common/interfaces/data_table';

/** The base interfact for roofline model property. */
declare interface RooflineModelProperty {
device_type?: string;
megacore?: string;
has_cmem?: string;
has_merged_vmem?: string;
peak_flop_rate?: string;
peak_hbm_bw?: string;
peak_cmem_read_bw?: string;
peak_cmem_write_bw?: string;
peak_vmem_read_bw?: string;
peak_vmem_write_bw?: string;
hbm_ridge_point?: string;
cmem_read_ridge_point?: string;
cmem_write_ridge_point?: string;
vmem_read_ridge_point?: string;
vmem_write_ridge_point?: string;
}

/** The base interfact for roofline model. */
export declare interface RooflineModelData extends SimpleDataTable {
p: RooflineModelProperty;
}
49 changes: 49 additions & 0 deletions frontend/app/components/hlo_stats/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("//defs:defs.bzl", "xprof_ng_module")

package(default_visibility = ["//frontend:internal"])

xprof_ng_module(
name = "hlo_stats",
srcs = [
"hlo_stats.ts",
"hlo_stats_module.ts",
],
assets = [
":hlo_stats_css",
"hlo_stats.ng.html",
],
deps = [
"@npm//@angular/core",
"@npm//@angular/router",
"@npm//@ngrx/store",
"@npm//rxjs",
"@org_xprof//frontend/app/common/angular:angular_material_divider",
"@org_xprof//frontend/app/common/angular:angular_material_expansion",
"@org_xprof//frontend/app/common/angular:angular_material_select",
"@org_xprof//frontend/app/common/angular:angular_material_tooltip",
"@org_xprof//frontend/app/common/constants",
"@org_xprof//frontend/app/common/interfaces",
"@org_xprof//frontend/app/common/interfaces:chart",
"@org_xprof//frontend/app/common/utils",
"@org_xprof//frontend/app/components/chart",
"@org_xprof//frontend/app/components/chart:chart_options",
"@org_xprof//frontend/app/components/chart:data_processor",
"@org_xprof//frontend/app/components/chart:default_data_provider",
"@org_xprof//frontend/app/components/chart/dashboard",
"@org_xprof//frontend/app/components/controls/category_filter",
"@org_xprof//frontend/app/components/controls/string_filter",
"@org_xprof//frontend/app/components/framework_op_stats/flop_rate_chart",
"@org_xprof//frontend/app/services/data_service",
"@org_xprof//frontend/app/store",
],
)

sass_binary(
name = "hlo_stats_css",
src = "hlo_stats.scss",
sourcemap = False,
deps = [
"@org_xprof//frontend/app/styles:common",
],
)
Loading

0 comments on commit 7b5c356

Please sign in to comment.