0

In Shane Cook's book CUDA Programming 2012, page 87, there is such a sentence:

As a consequence you get two transactions instead of one, as with the stripe layout.

The author talks about two kind of layouts: "square layout" and "stripe layout". From the quoted sentence, the author is very clear, square layout costs two transactions.

And what baffles me is: According to English syntax, what is the book author's opinion on stripe layout,

  • we get two transactions, or
  • we get one transaction?

enter image description here

7
  • 4
    The actual text as cited doesn't explicitly state that the stripe layout only has one transaction, and the syntactic construction is inherently ambiguous as regards whether as with the stripe layout refers back to preceding two transactions or one. So there's not really a question about use of English here, but pragmatically, I'd say it's virtually certain the stripe layout only has one transaction. Whatever that means. Apart from anything else, if the stripe layout also had two transactions, why raise the possibility of only one anyway? When would that happen? Sep 24, 2023 at 3:39
  • But I'm afraid stripe layout does have two transactions, same as square layout, because the author says "you get marginally quicker memory access". I think "marginally" means "very slightly" here. If memory access transactions is "once" vs "twice”, then the former should be twice as quicker.
    – Jimm Chen
    Sep 24, 2023 at 3:56
  • It sounds like you know the subject matter much better than me. Like I said, there's no easy way to choose between the two possible meanings just by looking at the syntax, because it's inherently ambiguous. Hence it's a pointless question here if that's what you're asking about; we can only discuss the nature of the syntactically ambiguous construction itself. But I must admit I thought "marginally quicker memory access" might reasonably reflect the fact that two transactions at a time can access more memory than one transaction, leading to faster total throughput. Sep 24, 2023 at 11:01
  • Thank you, I got your idea. Before I ask it here, I did not realize it is ambiguous. If it is ambiguous, then "you get A instead of B, as with C" should be considered awful tech wording. BTW: By author's context, "do once" is definitely quicker than "do twice", because the goal is the same, read 128-bytes of data from GPU RAM into GPU core.
    – Jimm Chen
    Sep 24, 2023 at 14:40
  • 1
    If I knew absolutely nothing about the subject matter (and wasn't trying to work it out using pragmatics / semantics), my default assumption for your text would be that as with the stripe layout refers back to preceding two transactions rather than one, because of the comma. I'd expect the comma (or a dash) to come after two transactions if we were supposed to associate stripe layout with one [transaction]. But you're right - it's badly phrased / punctuated. Sep 24, 2023 at 15:37

1 Answer 1

0

To paraphrase . . .

One of the reasons you would choose a square layout is that you get slightly quicker memory access with a single 128-byte transaction. The square layout is a single transaction. (Except if the array is small, in which case you’ll get two transactions, just like the stripe layout.)

So stripe layouts and small-array square layouts take two transactions. This would make that clearer:

As a consequence you get two transactions, as with the stripe layout, instead of one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.