Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: unwrap BasicBlock enum #772

Closed
wants to merge 6 commits into from
Closed

Conversation

ss2165
Copy link
Member

@ss2165 ss2165 commented Jan 3, 2024

BREAKING_CHANGES: DFB and Exit are now standalone structs. A level of nesting in serialization is also removed for these operations.

src/ops/validate.rs Outdated Show resolved Hide resolved
src/ops/validate.rs Outdated Show resolved Hide resolved
@acl-cqc
Copy link
Contributor

acl-cqc commented Jan 3, 2024

Ok, so the cunning followup which might make this DataflowParent trait (currently unused) really fly, is to provide an

impl<T: DataflowParent> ValidateOp for T {...}

noting that all impls (for such T) have the same validity_flags and I think that the differences in validate_op_children are captured exacttly by inner_signature....

@acl-cqc
Copy link
Contributor

acl-cqc commented Jan 3, 2024

My other thought is nomenclature. How about DFB -> BasicBlock and Exit -> ExitBlock? (DFB is very similar to DFG, I admit, but the one character that's different doesn't quite seem right)

@ss2165
Copy link
Member Author

ss2165 commented Jan 3, 2024

Yeah those new names seem a bit nicer - but that's definitely a broader spec-inclusive issue

@ss2165 ss2165 requested a review from acl-cqc January 4, 2024 11:40
@ss2165 ss2165 added this to the v0.1.0 milestone Jan 4, 2024
} => FunctionType::new(type_row![], type_row![]).with_extension_delta(extension_delta),
BasicBlock::Exit { .. } => FunctionType::new(type_row![], type_row![]),
})
Some(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I highly suspect this should be None (but instead we should implement fn extension_delta which by default delegates to this). However, that's not really part of this PR

BREAKING_CHANGES: DFB and Exit are not standalone structs. A level of nesting in serialization is also removed for these operations.
src/ops/validate.rs Outdated Show resolved Hide resolved

/// Functionality shared by DFB and Exit CFG block types.
pub trait BasicBlock {
/// The input signature of the contained dataflow graph.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dataflow signature of the values input to the block? (Exit blocks do not have a "contained dataflow graph")

@acl-cqc
Copy link
Contributor

acl-cqc commented Jan 4, 2024

Ok, so - on the naming front: the spec says DFB and Exit are the two types of Basic Block; this PR keeps DFB and Exit but largely drops the notion of "Basic Block"! So I think it would be fine to do some name changes in the code (with appropriate references to the spec - struct DataflowBlock is (in the spec) the dataflow subtype of Basic Block, and struct ExitBlock is (in the spec) the exit subtype of Basic Block).

But, generally, I'm happy to fold this into #754 and then follow up with a renaming PR. (The ideal would probably be to unwrap basicblock and rename in a first PR and then do #754 after, but I'm not going to make you do that!)

@acl-cqc
Copy link
Contributor

acl-cqc commented Jan 4, 2024

(I think we should not put #754 in without this, because of the rather dubious inner-signature for exit blocks)

@ss2165
Copy link
Member Author

ss2165 commented Jan 4, 2024

I've taken your suggestion and reordered the PRs, this one is being closed in favour of #781

@ss2165 ss2165 closed this Jan 4, 2024
@ss2165 ss2165 deleted the refactor/break-block branch January 4, 2024 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants