Modern Parallel Programming with C++ and Assembly Language Daniel Kusswurm download
Modern Parallel Programming with C++ and Assembly Language Daniel Kusswurm download
https://ebookmeta.com/product/modern-parallel-programming-with-c-
and-assembly-language-daniel-kusswurm/
https://ebookmeta.com/product/modern-x86-assembly-language-
programming-covers-x86-64-bit-avx-avx2-and-avx-512-3rd-edition-
daniel-kusswurm/
https://ebookmeta.com/product/modern-x86-assembly-language-
programming-covers-x86-64-bit-avx-avx2-and-avx-512-2nd-edition-
daniel-kusswurm/
https://ebookmeta.com/product/x86-64-assembly-language-
programming-with-ubuntu-ed-jorgensen/
https://ebookmeta.com/product/in-my-rearview-steamy-in-
sweetville-book-12-1st-edition-haven-rose-2/
Basic Georgian 3rd Edition Nana Danelia
https://ebookmeta.com/product/basic-georgian-3rd-edition-nana-
danelia/
https://ebookmeta.com/product/academic-skills-problems-fifth-
edition-workbook-edward-s-shapiro/
https://ebookmeta.com/product/petri-nets-for-modeling-of-large-
discrete-systems-asset-analytics-davidrajuh-reggie/
https://ebookmeta.com/product/living-with-heritage-the-case-of-
tsodilo-world-heritage-site-and-neighbouring-localities-1st-
edition-stella-basinyi/
https://ebookmeta.com/product/the-lost-daughter-emily-
slate-06-1st-edition-alex-sigmore/
Siam msi An Introduction to Service Integration and
Management Multi Sourcing Integration for IT Service
Management 1st Edition David Clifford
https://ebookmeta.com/product/siam-msi-an-introduction-to-
service-integration-and-management-multi-sourcing-integration-
for-it-service-management-1st-edition-david-clifford/
Modern Parallel
Programming with
C++ and Assembly
Language
X86 SIMD Development Using AVX,
AVX2, and AVX-512
—
Daniel Kusswurm
Modern Parallel
Programming with C++
and Assembly Language
X86 SIMD Development Using AVX, AVX2,
and AVX-512
Daniel Kusswurm
Modern Parallel Programming with C++ and Assembly Language: X86 SIMD
Development Using AVX, AVX2, and AVX-512
Daniel Kusswurm
Geneva, IL, USA
■
■Chapter 1: SIMD Fundamentals����������������������������������������������������������������������������� 1
What Is SIMD?������������������������������������������������������������������������������������������������������������������ 1
Historical Overview of x86 SIMD�������������������������������������������������������������������������������������� 4
SIMD Data Types��������������������������������������������������������������������������������������������������������������� 5
SIMD Arithmetic��������������������������������������������������������������������������������������������������������������� 7
SIMD Integer Arithmetic������������������������������������������������������������������������������������������������������������������������� 7
SIMD Floating-Point Arithmetic������������������������������������������������������������������������������������������������������������ 10
iii
■ Table of Contents
Summary������������������������������������������������������������������������������������������������������������������������ 50
■
■Chapter 3: AVX C++ Programming: Part 2����������������������������������������������������������� 53
Floating-Point Operations����������������������������������������������������������������������������������������������� 53
Floating-Point Arithmetic���������������������������������������������������������������������������������������������������������������������� 53
Floating-Point Compares���������������������������������������������������������������������������������������������������������������������� 59
Floating-Point Conversions������������������������������������������������������������������������������������������������������������������� 64
Floating-Point Arrays������������������������������������������������������������������������������������������������������ 68
Mean and Standard Deviation�������������������������������������������������������������������������������������������������������������� 69
Distance Calculations��������������������������������������������������������������������������������������������������������������������������� 78
Floating-Point Matrices�������������������������������������������������������������������������������������������������� 88
Column Means�������������������������������������������������������������������������������������������������������������������������������������� 89
Summary������������������������������������������������������������������������������������������������������������������������ 95
■
■Chapter 4: AVX2 C++ Programming: Part 1��������������������������������������������������������� 97
Integer Arithmetic����������������������������������������������������������������������������������������������������������� 97
Addition and Subtraction���������������������������������������������������������������������������������������������������������������������� 97
Unpacking and Packing���������������������������������������������������������������������������������������������������������������������� 102
Size Promotions���������������������������������������������������������������������������������������������������������������������������������� 107
Summary���������������������������������������������������������������������������������������������������������������������� 142
iv
■ Table of Contents
■
■Chapter 5: AVX2 C++ Programming: Part 2������������������������������������������������������� 145
Floating-Point Arrays���������������������������������������������������������������������������������������������������� 145
Least Squares������������������������������������������������������������������������������������������������������������������������������������� 146
Summary���������������������������������������������������������������������������������������������������������������������� 188
■
■Chapter 6: AVX2 C++ Programming: Part 3������������������������������������������������������� 189
Convolution Primer������������������������������������������������������������������������������������������������������� 189
Convolution Math: 1D������������������������������������������������������������������������������������������������������������������������� 189
Convolution Math: 2D������������������������������������������������������������������������������������������������������������������������� 192
Summary���������������������������������������������������������������������������������������������������������������������� 222
■
■Chapter 7: AVX-512 C++ Programming: Part 1������������������������������������������������� 223
AVX-512 Overview�������������������������������������������������������������������������������������������������������� 223
Integer Arithmetic��������������������������������������������������������������������������������������������������������� 224
Basic Arithmetic��������������������������������������������������������������������������������������������������������������������������������� 224
Merge Masking and Zero Masking����������������������������������������������������������������������������������������������������� 230
Summary���������������������������������������������������������������������������������������������������������������������� 255
v
■ Table of Contents
■
■Chapter 8: AVX-512 C++ Programming: Part 2������������������������������������������������� 259
Floating-Point Arithmetic��������������������������������������������������������������������������������������������� 259
Basic Arithmetic��������������������������������������������������������������������������������������������������������������������������������� 259
Compare Operations��������������������������������������������������������������������������������������������������������������������������� 265
Convolutions����������������������������������������������������������������������������������������������������������������� 289
1D Convolutions���������������������������������������������������������������������������������������������������������������������������������� 289
2D Convolutions���������������������������������������������������������������������������������������������������������������������������������� 294
Summary���������������������������������������������������������������������������������������������������������������������� 300
■
■Chapter 9: Supplemental C++ SIMD Programming������������������������������������������� 303
Using CPUID������������������������������������������������������������������������������������������������������������������ 303
Short Vector Math Library�������������������������������������������������������������������������������������������� 315
Rectangular to Polar Coordinates������������������������������������������������������������������������������������������������������� 316
Body Surface Area������������������������������������������������������������������������������������������������������������������������������ 325
Summary���������������������������������������������������������������������������������������������������������������������� 331
■
■Chapter 10: X86-64 Processor Architecture������������������������������������������������������ 333
Data Types�������������������������������������������������������������������������������������������������������������������� 333
Fundamental Data Types�������������������������������������������������������������������������������������������������������������������� 334
Numerical Data Types������������������������������������������������������������������������������������������������������������������������� 335
SIMD Data Types��������������������������������������������������������������������������������������������������������������������������������� 335
Strings������������������������������������������������������������������������������������������������������������������������������������������������ 335
vi
■ Table of Contents
Summary���������������������������������������������������������������������������������������������������������������������� 431
vii
■ Table of Contents
■
■Chapter 13: AVX Assembly Language Programming: Part 1����������������������������� 433
Integer Arithmetic��������������������������������������������������������������������������������������������������������� 433
Addition and Subtraction�������������������������������������������������������������������������������������������������������������������� 433
Multiplication�������������������������������������������������������������������������������������������������������������������������������������� 437
Bitwise Logical Operations����������������������������������������������������������������������������������������������������������������� 441
Arithmetic and Logical Shifts������������������������������������������������������������������������������������������������������������� 443
Summary���������������������������������������������������������������������������������������������������������������������� 453
■
■Chapter 14: AVX Assembly Language Programming: Part 2����������������������������� 455
Floating-Point Operations��������������������������������������������������������������������������������������������� 455
Floating-Point Arithmetic�������������������������������������������������������������������������������������������������������������������� 455
Floating-Point Compares�������������������������������������������������������������������������������������������������������������������� 461
Summary���������������������������������������������������������������������������������������������������������������������� 504
viii
■ Table of Contents
■
■Chapter 16: AVX2 Assembly Language Programming: Part 2��������������������������� 505
Floating-Point Arrays���������������������������������������������������������������������������������������������������� 505
Floating-Point Matrices������������������������������������������������������������������������������������������������ 510
Matrix Multiplication��������������������������������������������������������������������������������������������������������������������������� 510
Matrix (4 × 4) Multiplication��������������������������������������������������������������������������������������������������������������� 514
Matrix (4 × 4) Vector Multiplication���������������������������������������������������������������������������������������������������� 518
Summary���������������������������������������������������������������������������������������������������������������������� 552
■
■Chapter 18: AVX-512 Assembly Language Programming: Part 2���������������������� 553
Floating-Point Arithmetic��������������������������������������������������������������������������������������������� 553
Basic Arithmetic��������������������������������������������������������������������������������������������������������������������������������� 553
Compare Operations��������������������������������������������������������������������������������������������������������������������������� 558
Summary���������������������������������������������������������������������������������������������������������������������� 586
■
■Chapter 19: SIMD Usage and Optimization Guidelines�������������������������������������� 587
SIMD Usage Guidelines������������������������������������������������������������������������������������������������ 587
C++ SIMD Intrinsic Functions or x86 Assembly Language����������������������������������������������������������������� 588
ix
■ Table of Contents
■
■Appendix B: References and Resources������������������������������������������������������������ 621
C++ SIMD Intrinsic Function Documentation��������������������������������������������������������������� 621
X86 Programming References������������������������������������������������������������������������������������� 621
X86 Processor Information������������������������������������������������������������������������������������������� 622
Software Development Tools���������������������������������������������������������������������������������������� 622
Algorithm References��������������������������������������������������������������������������������������������������� 622
C++ References����������������������������������������������������������������������������������������������������������� 623
Utilities, Tools, and Libraries����������������������������������������������������������������������������������������� 624
Index��������������������������������������������������������������������������������������������������������������������� 625
x
About the Author
xi
About the Technical Reviewer
Mike Kinsner is a principal engineer at Intel developing languages and parallel programming models for a
variety of computer architectures. He has recently been one of the architects of Data Parallel C++. He started
his career at Altera working on high-level synthesis for field-programmable gate arrays and still contributes
to spatial programming models and compilers. Mike is a representative within the Khronos Group standards
organization, where he works on the SYCL and OpenCL open industry standards for parallel programming.
Mike holds a PhD in computer engineering from McMaster University and recently coauthored the
industry’s first book on SYCL and Data Parallel C++.
xiii
Acknowledgments
The production of a motion picture and the publication of a book are somewhat analogous. Movie trailers
extol the performances of the lead actors. The front cover of a book trumpets the authors’ names. Actors and
authors ultimately receive public acclamation for their efforts. It is, however, impossible to produce a movie
or publish a book without the dedication, expertise, and creativity of a professional behind-the-scenes team.
This book is no exception.
I would like to thank the talented editorial team at Apress including Steve Anglin, Mark Powers, and
Jim Markham for their efforts and contributions. I would also like to thank the entire production staff
at Apress. Michael Kinsner warrants applause and a thank you for his comprehensive technical review
and constructive comments. Ed Kusswurm merits kudos for reviewing each chapter and offering helpful
suggestions. I accept full responsibility for any remaining imperfections.
Thanks to my professional colleagues for their support and encouragement. Finally, I would like to
recognize parental nodes Armin (RIP) and Mary along with sibling nodes Mary, Tom, Ed, and John for their
inspiration during the writing of this book.
xv
Introduction
SIMD (single instruction multiple data) is a parallel computing technology that simultaneously executes the
same processor operation using multiple data items. For example, a SIMD-capable processor can carry out
an arithmetic operation using several elements of a floating-point array concurrently. Programs often use
SIMD operations to accelerate the performance of computationally intense algorithms in machine learning,
image processing, audio/video encoding and decoding, data mining, and computer graphics.
Since the late 1990s, both AMD and Intel have incorporated various SIMD instruction set extensions
into their respective x86 processors. The most recent x86 SIMD instruction set extensions are called AVX
(Advanced Vector Extensions), AVX2, and AVX-512. These SIMD resources facilitate arithmetic and other
data processing operations using multiple elements in a 128-, 256-, or 512-bit wide processor register (most
standard x86 arithmetic operations are carried out using scalar values in an 8-, 16-, 32-, or 64-bit wide
register).
Despite the incorporation of advanced SIMD capabilities in x86 modern processors, high-level
language compilers are sometimes unable to fully exploit these resources. To optimally utilize the SIMD
capabilities of a modern x86 processor, a software developer must occasionally write SIMD code that
explicitly employs the AVX, AVX2, or AVX-512 instruction sets. A software developer can use either C++
SIMD intrinsic functions or assembly language programming to accomplish this. A C++ SIMD intrinsic
function is code that looks like an ordinary C++ function but is handled differently by the compiler. More
specifically, the compiler directly translates a C++ SIMD intrinsic function into one or more assembly
language instructions without the overhead of a normal function (or subroutine) call.
Before continuing, a couple of caveats are warranted. First, the SIMD programming techniques
described in this book are not appropriate for every “slow” algorithm or function. Both C++ SIMD intrinsic
function use and assembly language code development should be regarded as specialized programming
tools that can significantly accelerate the performance of an algorithm or function when judiciously
employed. However, it is important to note that explicit SIMD coding usually requires extra effort during
initial development and possibly when performing future maintenance. Second, it should be noted that
SIMD parallelism is different than other types of parallel computing you may have encountered. For
example, the task-level parallelism of an application that exploits multiple processor cores or threads to
accelerate the performance of an algorithm is different than SIMD parallelism. Task-level parallelism and
SIMD parallelism are not mutually exclusive; they are frequently utilized together. The focus of this book is
x86 SIMD parallelism and software development, specifically the computational resources of AVX, AVX2,
and AVX-512.
xvii
Discovering Diverse Content Through
Random Scribd Documents
183 Better known by its running title, The Brytish Monarchie. It
is a very rare work, only 100 copies having been printed.
The author’s own copy is in the British Museum.
184 P.7.
187 Two MS. copies exist, one bound up with Dee’s copy of the
General and Rare Memorials in the British Museum, which
was sent to Dyer with the MS., the other in Harleian MSS.
249, fol. 95. The latter, which is a draft, is addressed “To
my very honorable frende Syr Edward Dyer, Knight,” and a
note inscribed on it says, “Written by Dr John Dee, out of
whose library I bought it after his death Ao Do 1625, S.D.”
The title on both MSS. is ΘΑΛΑΤΤΟΚΑΡΤΙΑ ΒΡΕΤΤΑΝΙΚΗ:
Miscelanea quædam extemporanea de Imperii Britannici
Iurisdictione in Mari; and both are dated 8th September
1597.
188 Lat. 49° 6´ N., long. 2° 49´ W.
189 “All those that pass within our sea jurisdiction (either
absolute or respective) and therein commit any notable
offence against us may lawfully by our power be taken;
and the same offenders may as lawfully and justly be
punished, as if on our land territory an offence like, or of
like degree of injury, were by them against us committed.”
“Absolute” jurisdiction applied to the sea where both
coasts belonged to England; “respective” where it
terminated half seas over.
190 In 1597 Dee expressed his grief and surprise that so little
had been done or attempted with regard to the
sovereignty of the sea, “and so my labours (after a sort)
vaynely employed.” MS.
198 Rot. Parl., iv. 79b. The petition declared that owing to the
fish having deserted the coasts where they used to be
taken, the fishermen had been forced to go to Iceland and
other places for six or seven years past in order to catch
them. English fishermen, however, had frequented Iceland
long before that time.
203 State Papers, Dom., Elizabeth, clxxx. 26, 15th July 1585.
208 Brit. Mus. Vespasian MSS., C. xiv. fol. 22. Fœdera, xvi. 431.
214 The price of stock-fish had risen from £12 a last in 1584 to
£18 and £20 in 1597, and the price of cured ling in the
same time advanced from £3 to £5, 5s. per cwt. State
Papers, Dom., cclxv.
218 35 Eliz., c. 7.
223 Acts of the Privy Council of England, iv. 37. 7th May 1552.
232 It will be noticed from fig. 4, where the lines between the
headlands are shown on a modern map, that some of the
“chambers” on the east coast have entirely disappeared,
no doubt owing to the erosion or silting up of the coast at
those places during the last three hundred years.
243
255 Manship, op. cit., 97, 120. The work was written between
1612 and 1619.
264 State Papers, Dom., James I., lxxi. 89. Malynes, who, as
already suggested in the note on page 128, may have
been the author of Cope’s tract, said exactly the same
thing in 1622—that there had been a continual agitation
for over thirty years to make busses and fisher-boats. The
Maintenance of Free Trade, 42.
275 State Papers, Dom., xlv. 22. The petition was signed by
fishermen of Yarmouth, Dover, Hastings, Rye, Hythe, and
Folkestone. It is said in the petition that they had
previously craved both the king and the Council for
redress, without avail.
276 The author of Britaines Buss had heard, but did not
believe, stories of the “very foul and insolent dealing of
their bussmen with our poor weak fishermen upon our
coasts.” Tobias Gentleman, who admired the Dutch for
their industry, said they scorned us only “for being so
negligent of our profit, and careless of our fishing; and
they do daily flout us that be the poor fishermen of
England, to our faces at sea, calling to us and saying, ‘Ya
English, ya zall, or oud scoue dragien,’ which in English is
this: ‘You English, we will make you glad for to wear our
old shoes.’” Englands Way to Win Wealth, p. 44.
277 Brit. Mus. Lansdowne MSS., 142, fol. 375. A copy of the
letter of the Lords of the Council, in the handwriting of Sir
Julius Cæsar, is as follows: After our very hearty
recommendations. Whereas his Majesty hath of late been
moved vpon many consyderations arising from the
complayntes of his subiects, to take some course of
restraynt of many inconveniences depending vpon the
excesse of libertie, wch is taken by the subiectes of
forraigne princes and states to fish vppon his coast; By
which, not onlie his owne ffishermen receive wrong in
their fishing, but the verie Coast-Townes themselves are
much decayed for lack of meanes to sett their people on
work. To wch end hee had resolved to set forth a
proclamation to th’effect of that wch is hereinclosed:
Fforasmuch as vppon perusall of some Treaties from King
Henry 7ths tyme till this daye betweene the Crowne of
England and the house of Burgundy, we fynde certeyne
clauses, by which there maye arise some question how
farre any such Prohibition maye concurre with the practice
of the same for so much as shall concerne the subiects of
that Estate; Of wch particulars it is necessary that some
deliberation were taken, beefore his Matie proceeded to a
generall execution of the same: We have thought good to
requyre yow ioyntly and severally to peruse all those
Treaties, and to consyder of them, and all other thinges,
by wch the lawfullnes or vnlawfulnes maye appeare of this
proceeding; Which being don wee shall expect some
report from you for his Maties better satisfaction.
Wherein wee doubt not but yow will proceede wth all
convenient expedition. And so will bid yow hartelie
farewell.
This copy is dated 1st February 1606, and the copy of the
report of the Committee is also dated 1606, which would
imply that the matter had been before the Privy Council in
that year. It appears, however, from other evidence that
Sir Julius Cæsar made a mistake in dating the copies.
278 Brit. Mus. Lansdowne MSS., 142, fol. 377. In Sir Julius
Cæsar’s handwriting, and endorsed, “A copy of a letter
from Mr Secretary Herbert, myself, and others to the Lds
of the King’s P. Councell, touching the prohibition of
strangers fishing on the coasts of England,” &c. This
important paper reads as follow: Our humble duties dewe
to yr good LLps. We have according to yr commandement,
considered of the liberty wch is taken by the Subiectes of
forreine Princes and States to fish vppon the kings Maties
coasts by wch not onely the English fishermen receive
wrong in their fishing but the very coast townes
themselves are much decayed for want of meanes to set
their people on work; and we have considered likewise of
the proclamation for the restraint of those many
inconveniences depending vppon the excesse of such
strangers fishing: We haue also pervsed the treaties frõ
Henry the 7th time till this day betweene the Crowne of
England and the House of Burgundy, and we have
considered of them, and of all other thinges by wch (as
wee conceave) the lawfulness or vnlawfulness may
appeare of this proceeding. And are of opinion, that the Ks
Maty may wthout breach of any treatyie nowe in force, or of
the lawe, vppon the reasons specified in the proclamation
sent vnto vs, restreine all strangers frõ fishing vppon his
coasts wthout license, in such moderation and after such
convenient notice given thereof by publik proclamation, as
his Maty shall think fit.
282 State Papers, Dom., xlv. 24. Proc. Coll., No. 11.
291 Winwood, Memorials, iii. 105, 135, 146, 162. Muller, op.
cit., 56.
292 State Papers, Dom., xlvii. 111. “2. For that it is by the
Lawe of nacions, no prince can Challenge further into the
Sea then he can Com̃ and wth a Cannon except Gulfes wthin
their Land from one point to an other. 3. For that the
boundlesse and rowlinge Seas are as Com̃ on to all people
as the ayre wch no prince can prohibite.” The paper is
endorsed “Reasons vsed by the Hollanders for the
Continuance of Fishing Contrarie to the proclamation
made in May 1609 forbidding of strangers to fish,” and
there is a note, apparently in Cæsar’s writing, saying,
“This note was sent by Emanuell Demetrius who was
present att the discourse.” It is misdated “Aug. 1609.” The
endorsements appear to have been made after 1612,
because at the end it is said, “It was answered by the late
Lord Treasr. Salisburie att a hearing,” &c. A list is given of
those present at the conference—viz., the Earls of
Salisbury, Northampton, Nottingham, Suffolk, Shrewsbury,
and Worcester, Mr Secretary Herbert and Sir Julius Cæsar,
the “Standers by” being Sir T. Edmondes, Sir Daniel Dunn,
Sir Christopher Perkins, Sir William Wade, and Mr Levinus
Emanuell Demetrius,—probably the Levinus Muncke of the
Dutch and other records. It is to be noted that the
argument as to the limitation of the territorial sea by the
range of guns was not contained in the instructions to the
Dutch, as printed by Aitzema (Saken van Staet en
Oorlogh, ii. 406) and Vreede (Vrijheid van Haringvaart, 6;
compare Muller, Mare Clausum, 58, 91), and is not
referred to by them in their Journal, where, however, they
say they put forward “other reasons” than those they
recite (Muller, Mare Clausum, 59). Van Meteren, whose
work was published in 1614 (Historie der Nederlandscher
ende haerder Naburen Oorlogen, &c., fol. 650), reports,
however, that there was a great dispute as to how far a
country’s limit might extend into the open sea, and the
brief note of Levinus seems to be the only record of it.
(“Sy seyden mede, dat het een groote dispute ware,
hoeverre elcx Laudts Custen ofte Limiten inde groote
wijde Zee Oceane mochte strecken.”) The document is of
interest not only from the clear enunciation of the doctrine
at so early a period, but because there are grounds for
thinking that the idea may have originated in the fertile
brain of Grotius. Competent Dutch authorities believe that
Grotius either himself drew up the instructions dealing
with the fishery question or was consulted in their
preparation; and the fact that the argument is not
contained in the official instructions scarcely weakens the
supposition. It was of so drastic and novel a character to
be urged against the pretensions of King James that the
Dutch, anxious to conciliate him, may have followed a
practice not uncommon in diplomacy, and kept it in the
background only to be made use of if a suitable occasion
arose. It is, moreover, known that Grotius had a close
personal relationship with Elias van Oldenbarnevelt, the
envoy to whom the fishery negotiations were specially
entrusted.
294 State Papers, Dom., xlvii. 111. Vreede, op. cit. Muller, op.
cit. Brit. Mus. Lansdowne MSS., 142, fol. 362. “Answers
for prohibiting of strangers fishing upon the English
coastes without the King’s license, 5th May 1610”—in the
writing of Sir Julius Cæsar.
298 Sir Walter Cope to the king, State Papers, Dom., lxxi. 89.
See note, p. 128.
310 Reg. Privy Council Scot., x. 231. Rec. Convent. Roy. Burghs
Scot., ii. 540.
311 The Lords of the Council to the king, 17th May 1614.
Melrose Papers, i. 130. “It wes fundin,” wrote the Lords,
“by vniforme voices and consent, without ony kynd of
contradictioun, that the assise dewytie aucht onlie to be
payit for the hering brought freshe and greene to land,
and that the hering whilkis ar maid, saltit, and barrellit
vpoun the sea, and maid reddye for the transporte, hes
nevir bene in vse to pay ony dewytie.”
312 Loc. cit. The “patent” was the treaty of 1594. See p. 81. It
may be mentioned that Mason, in his petition to Charles I.
(see p. 153 note), stated that in 1611 he collected “some
part” of the assize-herrings, but that upon the marriage of
the Princess Elizabeth (February 1613) “the States
ambassador made suit to the king for the remission of the
said assize-herrings due by their nation, which was
granted.” We have discovered no other evidence of this.
Loose statements were often made on the subject by
English writers and certain foreign authors, as Rapin (Hist,
d’Anglet., vii. 58), and Wagenaar (Vaderl. Hist., ix. 318)
following him, that the Dutch agreed to pay an annual
sum for liberty to fish on the British coasts. The error was
elaborated by others, as by Lediard in his great work
(Naval History of England, i. 420), who says: “In the year
1608 (sic) King James published a proclamation
prohibiting all foreign nations to fish on the coast of Great
Britain. This prohibition, though general, was designed
against the Dutch; and it occasioned the Treaty the year
following whereby they engaged to pay an annual sum for
leave to fish—an evident acknowledgment of the English
Dominion of the Seas.”
313 Rec. Conv. Roy. Burghs Scot., ii. 323, 350, 354, 374.
316 See p. 81. The treaty did not contain any stipulation of the
kind; and, moreover, the Scottish copy was then amissing.
317 Muller, Mare Clausum, 107. Brit. Mus. Add. MSS., 17,677, J,
fol. 153 et seq. Lansdowne MSS., 142, fol. 410. Reg. Privy
Counc. Scot., xi. 605, 608.
318 By the Scots Act, 1 James I., May 1424, regarding the
“custome of horse, nolt, scheepe, had furth of the realm,
and of herring,” it was ordained that the following should
be paid: “of ilk thousand of fresche herring sauld, of the
Sellar one penny, and of ilk last of herring, tane be
Scottis-men barrelled, foure schillinges, of ilk last be
strangeris taken, sexe schillinges.”
320 Carleton, Letters, 156, 157. Muller, op. cit., 110. Brit. Mus.
Add. MSS., 17,677, J, fol. 213b. Lansdowne MSS., 142, fol.
410. State Papers, Dom. Collection, Charles II., vol. 339.
322 Carleton, Letters, 168, 169, 172, 176, 186. Muller, op. cit.,
111.
323 Brit. Mus. Lansdowne MSS., 142, fol. 398, 400. “The State
of the Case between his Majesty and the States of the
United Provinces, touching the remanding to his Majesty
of a Delinquent,” 19th November 1617. In Cæsar’s
handwriting. It describes the circumstances of Brown’s
capture. The counsel whose opinion was obtained were
“W. Byrde (? Sir Wm. Bird, Dean of the Arches), H.
Marten, and Hy. Styward.” “Brown, his Majesty’s subject of
the Kingdom of Scotland, was by authority from that State
sent in a pinnace of the King to the subjects of the United
Provinces, who were then fishing for herrings upon the
coasts of Scotland, to demand a certain acknowledgment
claimed by his Majesty, as due unto him in the right of
that crown;” that “while delivering his errand he was
arrested and carried prisoner to Holland by the Dutch
commander, who pretended he had warrant and
commission from the Lords the States so to do; that his
Majesty (having represented this indignity by his
ambassador there to the Lords the States, the latter
disavowed the act of the captain) requireth the offender
there, to be remanded unto himself here to receive as to
justice shall appertain. The Question—Whether this
offender ought to be sent herein to his Majesty as is
required. Answer—There are good authorities that if a
subject of one State commit a heinous crime within the
territory of another State (though against a private
person), the subject so offending ought to be remitted to
the place where the crime was committed, if it be
required.” There were also opinions to the contrary, but
“two very particular circumstances about this offence
seem necessarily to enforce the remission of the Dutch
captain to his Majesty (1) taken from the person of
Brown, who was a public messenger sent by the State of
Scotland on the affairs of the Prince, and ought to have
been inviolable by the Law of Nations, and therefore a
wrong and abuse done to him was contra jus gentium; (2)
taken from the manner of the wrong done, which was
nomine publico—viz., by a pretended commission from the
Lords the States.”
326 12th March 1618. Reg. Privy Counc. Scot., xi. 329.
330 King James to Sir D. Carleton, 4th May 1618. “For the
other part, which is ye ancient custom alleadged by Or
Subjects that they (the Dutch) should not fish within
Kenning of Land, of which they make shew to be ignorant,
and would understand what is meant by it: you may say
that Or Subjects do conceave that Custom to be that no
strangers should fish either within the Creeks of Or Land
or within a Kenning of the Land as Seamen do take a
kenning, and insisting upon this interpretation of Or
Subjects’ meaning, you shall observe curiously their reply,
and what scope and liberty they do limit to themselves in
their fishing, and whether they understand that they may
fish where they list, near or far off, or that they may be
confined to any reasonable bounds, for thereupon will
depend a great part of that resolution which may be taken
hereafter in a matter of so great moment as this is, and
the answer you shall receive you may either advertise by
writing, or bring with you, as you shall find Or service to
require.” State Papers, Dom. Collections, Chas. II., vol.
339. In a later communication to the States-General
Carleton described the land-kenning thus: “Ce qui est une
limite bien entendue par gens de Marine, et appellée en
ces quartiers là The Kenning of the Land, et icy de kennis
vant landt.” Dr P. P. C. Hoek informs me that “het land
verkennen” is even now the technical Dutch expression
when a sailor comes near the coast without knowing at
what point he approaches it.
332 “Ane True Relatione of the Greifs and Wrangs qlks the
Inhabitants of the Isles of Orknay and Schetland and
Others his Maties Subjects Fishars within ye Kingdome of
Scotland sustains be the Hollanders and Hamburghgers
and wha within these few Zears are associat to the
Hollanders in the Fishing within his Maties Seas in
Scotland.” MSS. Advoc., 31. 2. 16. It may be noted that
the custom referred to in the last paragraph was of
Scandinavian origin.
333 The Council to the king, 4th April 1618. Melrose Papers, i.
306, 307.
338 The king to the Privy Council, 29th August 1618. Reg.
Privy Counc. Scot., xi. 440.
339 P. 131.