Skip to content

Commit

Permalink
Improve delay modeling of array index & selects with literal index/se…
Browse files Browse the repository at this point in the history
…lector

These should compile down to wires, so we should model them as adding no (logical) delay.

PiperOrigin-RevId: 614741494
  • Loading branch information
ericastor authored and copybara-github committed Mar 11, 2024
1 parent 500c6ec commit 1af2071
Show file tree
Hide file tree
Showing 7 changed files with 511 additions and 136 deletions.
1 change: 1 addition & 0 deletions xls/delay_model/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def delay_model(
srcs = [":{}_source".format(name)],
alwayslink = 1,
deps = [
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/status",
Expand Down
23 changes: 23 additions & 0 deletions xls/delay_model/delay_model.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ enum SpecializationKind {
HAS_LITERAL_OPERAND = 2;
}

// Describes more specifics of the condition under which the delay of the
// operation differs. For example, if the kind is HAS_LITERAL_OPERAND, this
// might specify that the literal operand must be operand 1.
message LiteralOperandDetails {
// If none are specified, then any operand is allowed to be non-literal.
repeated int64 allowed_nonliteral_operand = 1;

// If none are specified, then no specific operand is required to be literal.
repeated int64 required_literal_operand = 2;
}

// Describes an XLS operation (xls::Node) for the purposes of delay modeling.
message Operation {
// XLS Op (e.g., kAdd).
Expand All @@ -58,6 +69,12 @@ message Operation {
// the operands of the xls::Node represented by this proto are all identical,
// this field would be OPERANDS_IDENTICAL.
SpecializationKind specialization = 4;

message LiteralOperandInstanceDetails {
repeated int64 literal_operand = 1;
repeated int64 nonliteral_operand = 2;
}
LiteralOperandInstanceDetails literal_operand_details = 5;
}

// Describes a measured data point of the delay of an operation.
Expand Down Expand Up @@ -261,6 +278,12 @@ message OpModel {
message Specialization {
SpecializationKind kind = 1;
Estimator estimator = 2;
message Details {
oneof specialization_details {
LiteralOperandDetails literal_operand_details = 1;
}
}
Details details = 3;
}
repeated Specialization specializations = 3;
}
Expand Down
Loading

0 comments on commit 1af2071

Please sign in to comment.