WEBVTT

1
00:00:00.000 --> 00:00:09.133
This overview explains how to compare CM-IR and CSE-flat after
crediting both for the sharing and flattening they implement.

2
00:00:09.133 --> 00:00:15.633
A method name cannot explain a speed difference
when the relevant output structures are the same.

3
00:00:15.933 --> 00:00:21.900
Both expressions describe an A requirement combined with alternatives B and C.

4
00:00:21.900 --> 00:00:25.333
In the first, A is repeated in two branches.

5
00:00:25.333 --> 00:00:29.400
In the second, A appears once outside the alternative.

6
00:00:29.400 --> 00:00:33.467
The proposed relationship is distributivity, which is more than flattening

7
00:00:33.467 --> 00:00:36.700
a chain of identical operators.

8
00:00:36.700 --> 00:00:41.733
When A is zero, both branches of the first expression are zero.

9
00:00:41.733 --> 00:00:44.000
Their or is zero.

10
00:00:44.000 --> 00:00:48.767
The second expression also has an outer and with zero, so it returns zero

11
00:00:48.767 --> 00:00:51.233
regardless of B and C.

12
00:00:51.233 --> 00:00:55.333
This covers four complete assignments at once.

13
00:00:55.333 --> 00:00:59.900
When A is one, each and in the first expression passes through its other

14
00:00:59.900 --> 00:01:02.667
input, leaving B or C.

15
00:01:02.667 --> 00:01:06.067
The second expression reduces to the same result.

16
00:01:06.067 --> 00:01:10.367
The two cases for A exhaust its possibilities, establishing the identity

17
00:01:10.367 --> 00:01:13.567
for all eight assignments.

18
00:01:13.600 --> 00:01:19.633
Give CSE-flat and CM-IR credit for mechanisms they both implement.

19
00:01:19.633 --> 00:01:27.033
Then identify an actual extra transformation on the example,
rather than attributing any gain to a method name.

20
00:01:27.033 --> 00:01:32.533
For a conceptual normalization example, compare A AND A with A.

21
00:01:32.533 --> 00:01:35.933
Their two-assignment output columns agree.

22
00:01:35.933 --> 00:01:40.200
A compiler that removes this duplicate can eliminate an instruction here;

23
00:01:40.200 --> 00:01:45.467
a comparator that already performs
the same rewrite deserves the same credit.

24
00:01:45.467 --> 00:01:53.067
For the repeated S example, protect the shared child in both
arms before comparing the remaining lowered structures.

25
00:01:53.067 --> 00:01:59.367
The companion checks Boolean identities
separately from the repository compiler trace.

26
00:01:59.367 --> 00:02:05.467
Inspect the trace to establish which current
compiler actually performs a rewrite.

27
00:02:05.467 --> 00:02:13.728
Structural change is a mechanism observation; elapsed-time
advantage still requires a retained matched experiment.

28
00:02:13.728 --> 00:02:13.733
Structural change is a mechanism observation; elapsed-time
advantage still requires a retained matched experiment.

29
00:02:14.033 --> 00:02:19.367
Work a second complete case with A 1, B 0, C 1.

30
00:02:19.367 --> 00:02:22.800
Keep this assignment fixed throughout the calculation.

31
00:02:22.800 --> 00:02:26.767
Each symbol retains the meaning already introduced; a new value does not

32
00:02:26.767 --> 00:02:29.933
create a new logical rule.

33
00:02:29.933 --> 00:02:34.500
In the original form, the first branch is zero and the second branch is one,

34
00:02:34.500 --> 00:02:37.000
so their or is one.

35
00:02:37.000 --> 00:02:43.533
In the factored form, evaluate the parenthesized or first: zero or one gives one.

36
00:02:43.533 --> 00:02:46.833
Combining that with A one gives one.

37
00:02:46.833 --> 00:02:52.200
The two execution structures agree on this mixed-branch case.

38
00:02:52.200 --> 00:02:56.067
This case establishes a specific contrast.

39
00:02:56.067 --> 00:02:59.333
Two structures, one exact output.

40
00:02:59.333 --> 00:03:02.667
Distinct emitted code still needs inspection.

41
00:03:02.667 --> 00:03:07.733
Keep the input, intermediate values, and conclusion together when comparing

42
00:03:07.733 --> 00:03:09.967
it with the previous case.

43
00:03:09.967 --> 00:03:16.258
The calculated answer belongs to this complete assignment under the stated rule.

44
00:03:16.258 --> 00:03:16.267
The calculated answer belongs to this complete assignment under the stated rule.

45
00:03:16.567 --> 00:03:20.667
Suppose both compiler paths emit the factored graph.

46
00:03:20.667 --> 00:03:25.300
The mathematical identity is valid, but this example does not demonstrate a distinct

47
00:03:25.300 --> 00:03:28.733
mechanism that only one compiler supplies.

48
00:03:28.733 --> 00:03:33.667
Naming one path differently does not change that observation.

49
00:03:33.667 --> 00:03:39.333
If the emitted plans differ as shown, there is a concrete transformation to examine.

50
00:03:39.333 --> 00:03:43.167
Trace the nodes, the shared values, and the operations.

51
00:03:43.167 --> 00:03:48.400
Then verify exact outputs independently rather than assuming that a shorter-looking graph

52
00:03:48.400 --> 00:03:50.833
must be correct.

53
00:03:50.833 --> 00:03:56.900
A transformation can change sharing elsewhere in a larger graph, so inspect all consumers.

54
00:03:56.900 --> 00:04:00.633
Even a correct distinct transformation needs a fair cost comparison

55
00:04:00.633 --> 00:04:03.300
before supporting a runtime claim.

56
00:04:03.300 --> 00:04:09.367
This separates an identity, an implemented mechanism, and a measured benefit.

57
00:04:09.367 --> 00:04:09.374
Inspect the actual compiler trace for a distinct transformation.

58
00:04:09.374 --> 00:04:14.467
Inspect the actual compiler trace for a distinct transformation.

59
00:04:14.467 --> 00:04:20.832
Treat structural changes and measured
runtime advantages as separate observations.
