VM Maker: VMMaker.oscog-nice.2562.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: VMMaker.oscog-nice.2562.mcz

commits-2
 
Nicolas Cellier uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-nice.2562.mcz

==================== Summary ====================

Name: VMMaker.oscog-nice.2562
Author: nice
Time: 13 September 2019, 7:58:12.809297 pm
UUID: 86118d22-2779-3e4a-8c91-733adca6fbd1
Ancestors: VMMaker.oscog-eem.2561

Attempt to avoid fetching BitBlt source past end boundary.

This happens when we preload next source word.
We preload next source word when we think that first source word does not contain enough pixels to fill first dest word.

But this cannot happen if first source word contains more pixels than the whole BitBlt width (bbW).

Note that the temp variable startBits is 1 based, thus we can use bbW <= startBits rather than bbW < startBits to check if the whole BitBlt width fit on 1st word (both for dest nWord = 1 and src when testing the need for preload).

=============== Diff against VMMaker.oscog-eem.2561 ===============

Item was changed:
  ----- Method: BitBltSimulation>>destMaskAndPointerInit (in category 'setup') -----
  destMaskAndPointerInit
  "Compute masks for left and right destination words"
  | startBits pixPerM1 endBits |
  <inline: true>
  pixPerM1 := destPPW - 1.  "A mask, assuming power of two"
  "how many pixels in first word"
  startBits := destPPW - (dx bitAnd: pixPerM1).
  "how many pixels in last word"
  endBits := (dx + bbW - 1 bitAnd: pixPerM1) + 1.
  destMSB
  ifTrue:
  [mask1 := AllOnes >> (32 - (startBits * destDepth)).
  mask2 := AllOnes << (32 - (endBits * destDepth))]
  ifFalse:
  [mask1 := AllOnes << (32 - (startBits * destDepth)).
  mask2 := AllOnes >> (32 - (endBits * destDepth))].
  self cCode: [] inSmalltalk:
  [mask1 := mask1 bitAnd: 16rFFFFFFFF.
  mask2 := mask2 bitAnd: 16rFFFFFFFF].
 
  "determine number of words stored per line; merge masks if only 1"
+ bbW <= startBits
- bbW < startBits
  ifTrue: [mask1 := mask1 bitAnd: mask2.
  mask2 := 0.
  nWords := 1]
  ifFalse: [nWords := bbW - startBits + pixPerM1 // destPPW + 1].
  hDir := vDir := 1. "defaults for no overlap with source"
 
  "calculate byte addr and delta, based on first word of data"
  "Note pitch is bytes and nWords is longs, not bytes"
  destIndex := destBits + (dy * destPitch) + ((dx // destPPW) * 4).
  destDelta := destPitch * vDir - (4 * (nWords * hDir)) "byte addr delta"!

Item was changed:
  ----- Method: BitBltSimulation>>sourceSkewAndPointerInit (in category 'setup') -----
  sourceSkewAndPointerInit
  "This is only used when source and dest are same depth,
  ie, when the barrel-shift copy loop is used."
  | sxLowBits dxLowBits pixPerM1 startBits m1 |
  <inline: true>
  <var: 'm1' type: #'unsigned int'>
  self assert: (destPPW = sourcePPW and: [destMSB = sourceMSB and: [destDepth = sourceDepth]]).
  pixPerM1 := destPPW - 1.  "A mask, assuming power of two"
  sxLowBits := sx bitAnd: pixPerM1.
  dxLowBits := dx bitAnd: pixPerM1.
  "how many pixels in first word"
  startBits := hDir > 0
  ifTrue: [sourcePPW - (sx bitAnd: pixPerM1)]
  ifFalse: [(sx + bbW - 1 bitAnd: pixPerM1) + 1].
  m1 := destMSB
  ifTrue: [AllOnes >> (32 - (startBits * destDepth))]
  ifFalse: [AllOnes << (32 - (startBits * destDepth))].
+ preload := bbW <= startBits and: [(m1 bitAnd: mask1) ~= mask1]. "i.e. there are some missing bits"
- preload := (m1 bitAnd: mask1) ~= mask1. "i.e. there are some missing bits"
 
  "calculate right-shift skew from source to dest"
  skew := destDepth * (sourceMSB ifTrue: [sxLowBits - dxLowBits] ifFalse: [dxLowBits - sxLowBits]).  " -32..32 "
  preload ifTrue:
  [skew := skew < 0 ifTrue: [skew + 32] ifFalse: [skew - 32]].
 
  "Calc byte addr and delta from longWord info"
  sourceIndex := sourceBits + (sy * sourcePitch) + ((sx // (32 // sourceDepth)) * 4).
  "calculate increments from end of 1 line to start of next"
  sourceDelta := (sourcePitch * vDir) - (4 * (nWords * hDir)).
 
  preload ifTrue: "Compensate for extra source word fetched"
  [sourceDelta := sourceDelta - (4 * hDir)].
 
  self deny: (preload and: [skew = 0]).
  self assert: (skew between: -31 and: 31)!

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker.oscog-nice.2562.mcz

Nicolas Cellier
 
We should throw away this one, I'll retry, see below:

Le ven. 13 sept. 2019 à 20:00, <[hidden email]> a écrit :
 
Nicolas Cellier uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-nice.2562.mcz

==================== Summary ====================

Name: VMMaker.oscog-nice.2562
Author: nice
Time: 13 September 2019, 7:58:12.809297 pm
UUID: 86118d22-2779-3e4a-8c91-733adca6fbd1
Ancestors: VMMaker.oscog-eem.2561

Attempt to avoid fetching BitBlt source past end boundary.

This happens when we preload next source word.
We preload next source word when we think that first source word does not contain enough pixels to fill first dest word.

But this cannot happen if first source word contains more pixels than the whole BitBlt width (bbW).

Note that the temp variable startBits is 1 based, thus we can use bbW <= startBits rather than bbW < startBits to check if the whole BitBlt width fit on 1st word (both for dest nWord = 1 and src when testing the need for preload).

=============== Diff against VMMaker.oscog-eem.2561 ===============

Item was changed:
  ----- Method: BitBltSimulation>>destMaskAndPointerInit (in category 'setup') -----
  destMaskAndPointerInit
        "Compute masks for left and right destination words"
        | startBits pixPerM1 endBits |
        <inline: true>
        pixPerM1 := destPPW - 1.  "A mask, assuming power of two"
        "how many pixels in first word"
        startBits := destPPW - (dx bitAnd: pixPerM1).
        "how many pixels in last word"
        endBits := (dx + bbW - 1 bitAnd: pixPerM1) + 1.
        destMSB
                ifTrue:
                        [mask1 := AllOnes >> (32 - (startBits * destDepth)).
                         mask2 := AllOnes << (32 - (endBits * destDepth))]
                ifFalse:
                        [mask1 := AllOnes << (32 - (startBits * destDepth)).
                         mask2 := AllOnes >> (32 - (endBits * destDepth))].
        self cCode: [] inSmalltalk:
                [mask1 := mask1 bitAnd: 16rFFFFFFFF.
                 mask2 := mask2 bitAnd: 16rFFFFFFFF].

        "determine number of words stored per line; merge masks if only 1"
+       bbW <= startBits
-       bbW < startBits
                ifTrue: [mask1 := mask1 bitAnd: mask2.
                                mask2 := 0.
                                nWords := 1]
                ifFalse: [nWords := bbW - startBits + pixPerM1 // destPPW + 1].
        hDir := vDir := 1. "defaults for no overlap with source"

        "calculate byte addr and delta, based on first word of data"
        "Note pitch is bytes and nWords is longs, not bytes"
        destIndex := destBits + (dy * destPitch) + ((dx // destPPW) * 4).
        destDelta := destPitch * vDir - (4 * (nWords * hDir)) "byte addr delta"!

Item was changed:
  ----- Method: BitBltSimulation>>sourceSkewAndPointerInit (in category 'setup') -----
  sourceSkewAndPointerInit
        "This is only used when source and dest are same depth,
        ie, when the barrel-shift copy loop is used."
        | sxLowBits dxLowBits pixPerM1 startBits m1 |
        <inline: true>
        <var: 'm1' type: #'unsigned int'>
        self assert: (destPPW = sourcePPW and: [destMSB = sourceMSB and: [destDepth = sourceDepth]]).
        pixPerM1 := destPPW - 1.  "A mask, assuming power of two"
        sxLowBits := sx bitAnd: pixPerM1.
        dxLowBits := dx bitAnd: pixPerM1.
        "how many pixels in first word"
        startBits := hDir > 0
                                        ifTrue: [sourcePPW - (sx bitAnd: pixPerM1)]
                                        ifFalse: [(sx + bbW - 1 bitAnd: pixPerM1) + 1].
        m1 := destMSB
                        ifTrue: [AllOnes >> (32 - (startBits * destDepth))]
                        ifFalse: [AllOnes << (32 - (startBits * destDepth))].
+       preload := bbW <= startBits and: [(m1 bitAnd: mask1) ~= mask1]. "i.e. there are some missing bits"
-       preload := (m1 bitAnd: mask1) ~= mask1. "i.e. there are some missing bits"
Ah stupid! We must preload if it does not fit, that is bbW > startBits!!!
Let me retry...

        "calculate right-shift skew from source to dest"
        skew := destDepth * (sourceMSB ifTrue: [sxLowBits - dxLowBits] ifFalse: [dxLowBits - sxLowBits]).  " -32..32 "
        preload ifTrue:
                [skew := skew < 0 ifTrue: [skew + 32] ifFalse: [skew - 32]].

        "Calc byte addr and delta from longWord info"
        sourceIndex := sourceBits + (sy * sourcePitch) + ((sx // (32 // sourceDepth)) * 4).
        "calculate increments from end of 1 line to start of next"
        sourceDelta := (sourcePitch * vDir) - (4 * (nWords * hDir)).

        preload ifTrue: "Compensate for extra source word fetched"
                [sourceDelta := sourceDelta - (4 * hDir)].

        self deny: (preload and: [skew = 0]).
        self assert: (skew between: -31 and: 31)!