One arrangement of a trace, instead of three - #60
Merged
Conversation
kxray/models.py becomes a package of six files, one subject each, all of it re-exported so every existing import keeps working. kxshapes/scene.py is the new part. There were three conversions from a trace to a picture: the tape widget built its own cells, the blueprint generator printed an indented tree and drew no shapes at all, and a storyboard listed the shapes it used in a hand written field with no capture behind it. All three now read one Scene. The storyboard check gets teeth from it. shows is now compared against a scene built from the file the storyboard names, so a beat claiming a CPU lane over a uniprocessor capture is caught.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the
kxray.modelsrow of M1. Two things in here, and the second one is the reason for the first.The split
kxray/models.pywas 1424 lines holding six unrelated subjects, and it is now a package with one file each.Every one of the sixty odd call sites in the repository writes
from kxray.models import ..., and a re-exporting__init__keeps all of them working. The test suite passing unchanged is the proof, and that was checked before anything else was built on top of it.The rule the split is protecting is what goes in the docstring: nothing in there imports a renderer. Models are the bottom of the stack,
kxshapesworks out geometry from them, and the two renderers draw whatkxshapesreturns. A model that knows how it is drawn is a model that two renderers will fight over.The part that matters
The M1 exit criterion says all nine primitives have to be driven from the same objects. They were not. There was one parser and three renderers, which is the design, and three separate conversions from a trace to a picture, which is not:
kxwidgets/tape.pywalked the frames and built its ownTraceCellfor each one, and wrote its own hover text in a private_titlemethod.tools/bpcgen.pyprintedtape.tree()as an indented block and drew no shapes at all, so a blueprint of a capture and a notebook of the same capture had nothing in common.kxmanimstoryboard listed the shapes it used in a hand writtenshowsfield with no trace behind it.So a notebook, a blueprint and an animation of one recording were three separate readings of it that happened to agree, and nothing anywhere would have said so on the day they stopped.
kxshapes/scene.pyis now the one reading. ASceneis lanes ofSteps, each step holding one of the nine shapes and the sentence that goes with it, in call order. What each renderer does with that is the part allowed to differ: the widget draws every step at once, the blueprint prints them as a table, the animation reveals them alongorder.The sentence matters as much as the numbers.
Step.detailis the hover text on a box in a notebook, the note under a still and what a screen reader reads, and those three saying different things about the same call is exactly the failure this is trying to make impossible.What a blueprint gets now
Section 5 of
write-path.mdused to print the indented tree and stop. It still prints it, because the tree is what a specification is about, and now it also prints the drawing as a table, generated from the sameScenethe notebook draws.Those last two rows are the honest bit surviving the trip. The third call in that capture was cut off by the tracer window, so its children have no measured width and were placed by counting instead. The widget outlines them in red, the table says
placed by call order, and both read it off the same flag.The storyboard check has teeth now
showswas a list of words checked against the closed set of nine. A beat could saycpu-laneover a capture from a uniprocessor emulator and pass, becausecpu-laneis one of the nine.It is now also checked against a scene built from the file the storyboard actually names.
cpu-interleaveclaimscpu-laneand points atcorpora/traces/tier1/multi-cpu-write.txt, which really does have six of them. Pointing the same storyboard at a Tier 0 capture gives:Only the two shapes a trace can speak to are checked, and only when the storyboard names a capture.
lock-cycledraws CPU lanes out of a lockdep report on a machine with one processor, and that mismatch is the subject of the beat rather than a mistake in it. A rule that went by the shape alone would fire on the one animation where the kernel drawing two CPUs that were not there is the whole point, and a rule that has to be argued with is a rule somebody switches off.One invariant worth naming
_by_cpuwalks the spans itself rather than callingkxshapes.lanes, because it needs the frame each cell came from to build the words and aCpuLanehands back cells with the frames already dropped. Matching the two lists up by position would be correct today and quietly wrong the first time either walk changed what it filters. So there is a test instead,test_a_cpu_scene_holds_the_same_cells_as_the_lane_function, asserting the two agree cell for cell across all 109 cells of the six CPU capture.Checked
tests/test_scene.pyis 21 tests. The ones carrying weight are the three that pin two things together: the widget draws the cells the scene produced, the CPU lanes are the cellslanes()builds one for one, and the hover text in the notebook is the stringdetail_ofreturns.The whole gate:
The blueprints were regenerated with
--btf kxbox/kernel/build/A-full/vmlinuxso sections 2 and 7 keep their real type information. Regenerating without it silently replaces both with a note saying there was no BTF, which is a thousand lines of measured layout turning into an apology, and it is worth writing down here because it is not obvious from the command.What is still open
refchecknow has a directory where it had a file, which is whyLAYOUT.mdandkxray/source/__init__.pyneeded the three prose fixes in this diff.Scenecovers the trace shapes. The other seven primitives are still built by their callers, and folding those in is the next row rather than this one.