-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdata-en.yaml
4033 lines (4026 loc) · 122 KB
/
data-en.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-
name: athread_init
params:
-
return int: |
Success: Returns 0, indicating that the acceleration thread initialization was successful;
Failure: Any other return value indicates an error. If any of the following conditions are detected, athread_init () will fail and return the corresponding value:
-EINVAL: Initialization failed.
cates: [Athread]
tags: [MPE]
desc: |
To complete the initialization of the accelerated thread library, you must call this interface before using any thread library interface.
header: "athread.h"
# inst: test1
# op: |
# c = a + b
# return c
-
name: athread_create
params:
-
int id: thread binding ID number
-
start_routine fpc: function pointer
-
void * arg: the starting address of the parameter of function f
-
return int: |
Success: 0 is returned.
Failure: Any other return value indicates an error. If any of the following conditions are detected, athread_create () will fail and return the corresponding value:
-EAGIAN: The system limit was exceeded and too many threads were created.
-EINVAL: The ID number is illegal (negative, or exceeds the maximum number of threads); or the ID number is already occupied and the occupied resources are not released.
header: athread.h
tags: [MPE]
cates: [Athread]
desc: |
Add a new controlled thread in the current process. The starting task executed by the thread is specified by the function fpc; the parameters of the function fpc are provided by arg.
After the thread is bound to the ID number, the thread position has nothing to do with the ID number. If you need to know the information of the secondary core resources occupied by the thread in the core group, you can call the relevant interface to get this type of information.
-
name: athread_wait
params:
-
int id: waiting thread id number
-
return int: |
Success: return 0;
Failure: Any other return value indicates an error
-ESRCH: The thread corresponding to the specified thread ID was not found.
-EINVAL: The ID number is illegal.
desc: |
Explicitly block the calling thread until the specified thread terminates. The specified thread must be in the current process.
header: athread.h
tags: [MPE]
cates: [Athread]
-
name: athread_end
params:
-
int id: Specify the thread ID number
-
return int: |
Success: returns 0, the slave core resource occupied by the thread is successfully closed.
Failure: Any other return value indicates an error. If any of the following conditions are detected, athread_end () will fail and return the corresponding value.
-ESRCH: The thread corresponding to the given thread ID was not found.
-EINVAL: The thread failed to terminate from the core pipeline, and the thread corresponding to the ID is still running.
desc: |
After determining that the slave core has no related operations, the slave core pipeline is stalled, and the slave core is shut down.
You must ensure that there are no user jobs for the slave core to use this function.
eg: |
typedef void * (* start_routine) (void *);
int fun (void * arg) {
retrun (int) arg [0] + (int) arg [1];
}
main () {
int tid1, tid2;
int arg1 [2], arg2 [2];
// Thread library initialization
athread_init ();
// Create a binding thread, the thread ID number is 0
arg1 [0] = 1;
arg1 [1] = 2;
athread_create (0, fun, arg1);
// Create a binding thread, the thread ID number is 1
arg2 [0] = 3;
arg2 [1] = 4;
athread_create (1, fun, arg2);
// Wait for the thread to end
athread_wait (0);
athread_wait (1);
// Close the slave core pipeline occupied by the thread, and the slave core cannot continue to be used in this process
athread_end (0);
athread_end (1);
}
header: athread.h
tags: [MPE]
cates: [Athread]
-
name: athread_spawn
params:
-
start_routine fpc: function pointer;
-
void * arg: The starting address of the parameter of function f.
-
return int: |
Success: 0 is returned.
Failure: Any other return value indicates that an error has occurred. If any of the following conditions are detected, athread_spawn () will fail and return the corresponding value.
-EINVAL: Thread group creation failed.
desc: |
Add a new controlled thread group in the current process. The task performed by the thread is specified by the function fpc; the parameters of the function fpc are provided by arg.
When the athread_spawn interface is called, all available slave core resources in the core group are started. If you need to know the secondary core resource information occupied by the thread group in the core group, you can call the relevant interface to get this type of information.
header: athread.h
tags: [MPE]
cates: [Athread]
-
name: athread_join
params:
-
return int: |
Success: return 0;
Failure: Any other return value indicates an error
-EINVAL: No thread group is running in the core group.
desc: |
Explicitly block waiting for the thread group until the specified thread group is terminated. The specified thread group must be in the current process.
header: athread.h
tags: [MPE]
cates: [Athread]
-
name: athread_halt
desc: |
After determining that all slave cores have no related operations, the slave core group pipeline is stopped, and the slave core group is shut down.
You must ensure that there is no user job for the slave core group to use this function.
params:
-
return int: |
Success: returns 0, the slave core resource occupied by the thread is successfully closed.
Failure: Any other return value indicates an error. If any of the following conditions are detected, athread_halt () will fail and return the corresponding value.
-EINVAL: The secondary nuclear resource cannot be shut down normally.
header: athread.h
tags: [MPE]
cates: [Athread]
-
name: athread_spawn_group
desc: |
Add a new controlled thread group with mask code in the current process. The task performed by the thread is specified by the function fpc; the parameters of the function fpc are provided by arg.
When the athread_spawn_group interface is called, all slave core resources in the shield code are started. If you need to know the secondary core resource information occupied by the thread group in the core group, you can call the relevant interface to get this type of information.
params:
-
unsigned long gmask: mask code from the core;
-
start_routine fpc: function pointer;
-
void * arg: The starting address of the parameter of function f.
-
return int: |
Success: 0 is returned.
Failure: Any other return value indicates an error. If any of the following conditions are detected, athread_spawn_group () will fail and return the corresponding value.
-EINVAL: Thread group creation failed.
header: athread.h
tags: [MPE]
cates: [Athread]
-
name: athread_join_group
desc: |
Explicit blocking waits for the end of the task of the thread group with the mask code until the specified thread group terminates and exits the interface. The specified thread group must be in the current process.
params:
-
unsigned long gmask: mask code from the core
-
return int: |
Success: return 0;
Failure: Any other return value indicates an error
-EINVAL: No thread group is running in the core group.
header: athread.h
tags: [MPE]
cates: [Athread]
-
name: athread_task
desc: |
Create a preemptive dynamic scheduling main core thread. The executed thread task is specified by the function fpc; arg is specified by the user, the total number of thread tasks, the value represents the judgment flag of the end of the task.
params:
-
start_routine fpc: function pointer;
-
void * arg: total number of tasks
-
return int: |
Success: return 0;
Failure: Any other return value indicates an error
-EINVAL: Thread group creation failed.
header: athread.h
tags: [MPE]
cates: [Athread]
-
name: athread_spawn_task
header: athread.h
tags: [MPE]
cates: [Athread]
desc: |
Create a preemptive dynamic scheduling slave core thread group. The executed thread task is specified by the function fpc; arg is specified by the user, the total number of thread tasks, the value represents the judgment flag of the end of the task.
Since the master-slave core code uses different compilers, the code compiled by the slave core cannot be called by the master core, and vice versa, the user must ensure that the preemption tasks involved in the master core and slave core have their own corresponding code and compilation support.
params:
-
start_routine fpc: function pointer;
-
void * arg: total number of tasks
-
return int: |
Success: 0 is returned.
Failure: Any other return value indicates an error. If any of the following conditions are detected, athread_spawn_task () will fail and return the corresponding value.
-EINVAL: Thread group creation failed.
-
name: athread_get_max_threads
header: athread.h
tags: [MPE]
cates: [Athread]
desc: |
Use this interface to get the total number of all core group thread resources available for the current process.
params:
-
return int: |
Success: Returns the maximum number of threads available in the core group (1 <= ret <= 64);
Failure: Any other return value indicates an error. If any of the following conditions are detected, athread_get_max_threads will fail and return the corresponding value.
-EINVAL: Return failed with an exception.
-
name: athread_set_num_threads
header: athread.h
tags: [MPE]
cates: [Athread]
desc: |
Use this interface to set the total number of all core group threads started in the next parallel zone of the current process.
params:
-
int num: total number of threads
-
return int: |
Success: 0;
Failure: Any other return value indicates an error. If any of the following conditions are detected, athread_set_num_threads will fail and return the corresponding value.
-EAGAIN: Set the number of threads to exceed the available thread resources, this value will be returned.
-EINVAL: Failed to set the number of threads in the parallel area, for example, the task of the previous parallel area was not completed.
-
name: athread_get_num_threads
header: athread.h
tags: [MPE]
cates: [Athread]
desc: |
Use this interface to get the total number of all core group threads started by the current process.
params:
-
return int: |
Success: Returns the number of threads in the current core group (1 <= ret <= 64);
Failure: Any other return value indicates an error. If any of the following conditions are detected, athread_get_num_threads will fail and return the corresponding value.
-EINVAL: Return failed with an exception.
-
name: athread_cancel
header: athread.h
tags: [MPE]
cates: [Athread]
desc: |
This function is used to terminate the specified thread, and the thread ID and resources can be recovered immediately.
The end of the thread can be terminated by the following methods:
Return from the first process of the thread, that is, the thread's startup routine. Refer to athread_create.
Call athread_cancel to exit early.
params:
-
int id: specify the exit thread number
-
return int: |
Success: return 0;
Failure: Any other return value indicates an error. If any of the following conditions are detected, athread_cancel will fail and return the corresponding value.
-ESRCH: The thread corresponding to the specified thread ID was not found.
-EINVAL: The ID number is illegal.
-EFAULT: The ID thread corresponds to the slave core failure.
-
name: athread_signal
header: athread.h
tags: [MPE]
cates: [Athread]
desc:
Receive an interrupt and specify the interrupt processing function.
Refer to the athread_sigqueue () interface.
params:
-
int signo: interrupt signal
-
start_routine fpc: interrupt handler function
-
return void:
-
name: Exception_Kind
params:
-
enum UNALIGN: out of bounds exception
-
enum ILLEGAL: illegal instruction
-
enum OVI: integer overflow
-
enum INE: inexact results
-
enum UNF: underflow
-
enum OVF: overflow
-
enum DBZ: divisor is 0
-
enum INV: invalid operation
-
enum DNO: denormalized number
-
enum CLASSE1: classification counter overflow
-
enum CLASSE2: abnormal classification parameter setting
-
enum SELLDWE: Vector lookup table is abnormal
-
enum LDME: LDM related exception
-
enum SDLBE: Unauthorized or out of bounds occurred during SDLB replacement
-
enum MABC: The address to access the main memory exceeds the actual configured capacity of the main memory
-
enum MATNO: main memory access target core group is not in place
-
enum RAMAR: Received memory access exception error response from the core
-
enum IFLOWE: abnormal instruction flow
-
enum SBMDE1: SBMD match exception and SBMD query exception
-
enum SBMDE2: Other SBMD anomalies
-
enum SYNE1: The synchronization vector sent from the core does not contain the current core
-
enum SYNE2: degradable synchronization is not enabled
-
enum RCE: abnormal communication
-
enum DMAE1: DMA generates DMA descriptor static check exception
-
enum DMAE2: DMA generates DMA descriptor static check warning
-
enum DMAE3: reserved
-
enum DMAE4: It is possible that the access address exceeds the LDM capacity during the use of row collection mode
-
enum DMAE5: reserved
-
enum IOE1: access reserved IO space address
-
enum IOE2: Unauthorized access to IO
-
enum IOE3: IO is not accessible
-
enum OTHERE: all kinds of exceptions that users don't care about
-
return enum:
desc: the type of exception that can be mounted
-
name: athread_expt_signal
header: athread.h
tags: [MPE]
cates: [Athread]
desc: |
Mount specific exception handling functions.
a: Exception type:
According to Shenwei 26011 slave nuclear exception type, users can mount 32 exception handling signals in Exception_Kind.
b: Mounting method
athread_expt_signal (int exceptnum, void * handler)
c: exception handling function
The prototype of the user-defined exception handling function is:
handler_t * handler (int signum, siginfo_t * sinfo, struct sigcontext * sigcontext)
The first parameter: signum is an abnormal signal
The second parameter: sinfo information is as follows:
sinfo-> si_signo = signum; // abnormal signal
sinfo-> si_pid = peid; // Abnormal slave core number
sinfo-> si_uid = cgid; // Abnormal core group number
The third parameter: The first three parameters of sigcontext are used to retain specific information, as follows:
sigcontext-> sc_onstack // Whether the slave nuclear abnormal PC is accurately marked
sigcontext-> sc_pc // From abnormal nuclear PC
sigcontext-> sc_mask // Abnormal access to information from nuclear data stream
If sc_pc is 0, there is no abnormal PC. If it is not 0, judge whether it is an accurate PC according to sc_onstack.
When sc_onstack is 0, there is no precise abnormal PC. At this time, sc_pc records the inaccurate PC when the exception occurs; sc_onstack is 1 indicates that there is a precise abnormal PC. At this time, sc_pc records the accurate PC when the exception occurs;
The sc_mask item is only valid for the data flow exception DFLOWE. 4b`0001 means LD main memory, 4b`0010 means ST main memory, 4b`0100 means DMA_GET, and 4b`1000 means DMA_PUT.
The contents of other fields of sigcontext are determined by os and passed to the user processing program as they are.
When an exception occurs, the thread library will report the first caught exception. This exception can be a core group exception or a slave core exception. If the user does not mount the corresponding handler for the exception, the thread library will print all the information related to the exception, halt the abnormal slave core, and exit the program; if the user mounts the handler for the exception, enter the user-defined Exception handling function.
(For parallel C library: athread_expt_signal_for_ccc (void * handler)
The parallel C library uses this function to mount all abnormal events. When an exception occurs, it will enter the exception function defined by the parallel C library for processing. The parameters of the handler function are as follows:
void handle (int sig, siginfo_t * sinfo, struct sigcontext * sigcontext)
The content of the above three parameters is determined by the operating system and passed to the parallel C library exception handling function as is
)
params:
-
int signo: abnormal signal
-
start_routine fpc: exception handling function
-
name: IO_addr
header: athread.h
tags: [MPE]
cates: [Athread]
desc:
The master core can access the local storage through IO. This macro returns the IO address of the slave core LDM variable element.
The IO_addr macro does not judge the legality of penum and cgnum, and is guaranteed by the user.
params:
-
element: Locally stored private variable __thread_local elment in the core program, extern __thread must be added as an external variable before the master core uses the IO_addr interface
-
penum: nuclear number
-
cgnum: nuclear group number
-
return: return IO address
eg: |
From the nuclear program slave.c:
__thread_local char ch = 'b';
__thread_local long para [10] __attribute __ ((__ aligned __ (128))) = {0x123, 0x234, 0x345, 0x456};
Main nuclear program main.c:
extern long __thread para [];
extern char __thread ch;
unsigned long LDM_addr;
LDM_addr = IO_addr (para [0], 23, 0);
In this way, LDM_addr is equal to the IO address of para [0] on the secondary core of core group 0
-
name: h2ldm
header: athread.h
tags: [MPE]
cates: [Athread]
desc: |
The master core can access the local storage through IO, this macro directly performs IO access operations on the slave core LDM variable element in the master core
The h2ldm macro does not judge the legality of penum and cgnum, and is guaranteed by the user.
params:
-
element: Locally stored private variable __thread_local elment in the core program, extern __thread must be added as an external variable before the master core uses the IO_addr interface
-
penum: nuclear number
-
cgnum: nuclear group number
-
return:
eg: |
From the nuclear program slave.c:
__thread_local char ch = 'b';
__thread_local long para [10] __attribute __ ((__ aligned __ (128))) = {0x123, 0x234, 0x345, 0x456};
Main nuclear program main.c:
extern long __thread para [];
extern char __thread ch;
unsigned long LDM_addr;
h2ldm (para [0], 23, 0) = 0xaaa;
h2ldm (ch, 5, 1) = 'z';
The master checks the assignment of the local storage variable para [0] on the 23rd slave core of the No. 0 core group; the master checks the assignment of the local storage variable ch on the 5th slave core of the No. 1 core group.
Remarks:
The thread create and spawn interfaces have only one parameter interface. The master core access slave storage interface can be used as the master core to perform batch parameter assignment for the core group acceleration area. For example: the slave core program specifically applies for a local storage space for storing parameters. The master core can assign values to this parameter area before starting different acceleration areas; if the same parameters are assigned to each slave core, it is usually best practice It is to assign parameters to only one slave core, and then the slave core broadcasts the parameters to all slave cores on the core group through register communication.
-
name: athread_idle
header: athread.h
tags: [MPE]
cates: [Athread]
desc:
Use this function to obtain whether the current slave core thread group is idle.
The idle state here refers to a state of waiting for a task, that is, the thread group does not execute the slave core acceleration thread of the user spawn or the thread group has completed the user spawn slave core acceleration thread.
params:
-
return unsigned long: |
If the slave core group is idle, it returns the currently available slave core bitmap; otherwise, it returns 0.
eg: |
unsigned long idleslave;
if (idleslave = athread_idle ())
{
Use slave optimization (spawn);
...
}
-
name: athread_task_info
header: athread.h
tags: [MPE]
cates: [Athread]
desc: |
Query the number of core groups participating in the task execution and the core group number of the current core group in the CPU where the task is located. Obtain the corresponding value by looking at the internal library variables __cgid / __ cgnum respectively.
Before calling this interface, you must first call athread_task_info to initialize __cgid and __cgnum, and notify the number of core groups participating in synchronization through internal variables.
The interface will occupy 64B (0x6000000000 ~ 0x6000000000 + 0x40) of the data before the cross section as the lock space. Users need to avoid this space when using this interface to prevent unpredictable errors.
-
name: athread_master_sync
header: athread.h
tags: [MPE]
cates: [Athread]
desc: |
Synchronization between core groups.
Before calling this interface, you must first call athread_task_info to initialize __cgid and __cgnum, and notify the number of core groups participating in synchronization through internal variables.
The interface will occupy 64B (0x6000000000 ~ 0x6000000000 + 0x40) of the data before the cross section as the lock space. Users need to avoid this space when using this interface to prevent unpredictable errors.
-
name: athread_get_id
header: slave.h
tags: [CPE]
cates: [Athread]
desc: |
Use this function to obtain the logical identification number (ie ID number) of the local single thread. This interface is common to the master and slave cores.
As long as the thread is started with athread_create to create a single-threaded interface, there will be a bound identifier.
params:
-
int core: Specifies to query the physical core number, -1 default local slave core (the slave core interface is valid).
-
return int: |
Success: the logical ID number of the thread (0 <= ret <= 63).
Failure: Any other return value indicates an error. If any of the following conditions are monitored, athread_get_id will fail and return the corresponding value.
-EINVAL: Return failed with an exception.
eg: |
int myid;
myid = athread_get_id (-1);
-
name: athread_get_core
header: slave.h
tags: [CPE]
cates: [Athread]
desc: |
Use this interface to obtain the physical slave core number of the corresponding thread. This interface is common to the master and slave cores.
The lower 6 digits of the return value are valid, the lower 3 digits are the column number, and the upper 3 digits are the row number, which respectively represent the core group 8 * 8 array.
params:
-
int id: Specify the query thread number, -1 default local thread (valid from the core interface)
-
return int: |
Success: The physical core number occupied by the thread (0 <= ret <= 63).
Failure: Any other return value indicates an error. If any of the following conditions are monitored, athread_get_core will fail and return the corresponding value.
-EINVAL: Return failed with an exception.
eg: |
int mycore;
mycore = athread_get_core (-1);
-
name: athread_sigqueue
header: slave.h
tags: [CPE]
cates: [Athread]
desc: |
The slave core sends an asynchronous interrupt carrying a message to the master core. After the interrupt is issued, the slave core does not wait for the master core to receive the interrupt and complete the interrupt processing function, but continues to execute subsequent slave core code.
params:
-
int pid: main process, represented by 0
-
int signo: break number
-
const union sigval value: interrupt message
-
return int: |
Success: return 0;
Failure: Any other return value indicates an error. If any of the following conditions are detected, athread_sigqueue () will fail and return the corresponding value.
-EINVAL: signo is invalid, or sending a message fails.
eg: |
How to properly mount an interrupt handler function:
Assuming that the master-slave core agrees that when the slave core sends a SW3_SIGMAX-1 signal, the master core calls the interrupt handler x_handler.
From the nuclear program:
a = 1234567890;
fun ()
{
// The interrupt signal SW3_SIGMAX-1
// And interrupt carrying information & a sent to the main process.
athread_sigqueue (0, SW3_SIGMAX-1, & a)
}
Main nuclear program:
x_handler (int sig, siginfo_t * sinfo, struct sigcontext * sigcontext)
{
union sigval sv;
printf ("x_handler begin! \ n");
// sv == Carry information from nuclear interrupt & a
sv = sinfo-> si_value;
}
main ()
{
athread_signal (SW3_SIGMAX-1, x_handler); // Consistent with usage of signal
}
-
name: athread_sigsend
header: slave.h
tags: [CPE]
cates: [Athread]
desc: |
The slave core sends a message-carrying synchronous interrupt to the master core. After the interrupt is issued, the slave core waits for the master core to receive the interrupt until it completes the interrupt processing function and can continue to execute the subsequent slave core code.
params:
-
int pid: main process, represented by 0
-
int signo: break number
-
const union sigval value: interrupt message
-
return int: |
Success: return 0;
Failure: Any other return value indicates an error. If any of the following conditions are detected, athread_sigsend () will fail and return the corresponding value.
-EINVAL: signo is invalid, or sending a message fails.
eg: |
Refer to the description of athread_sigqueue.
-
name: athread_get
header: slave.h
tags: [CPE]
cates: [Athread]
desc: |
The LDM from the core office receives the data of the main memory MEM, performs the data get operation from the main memory MEM to the slave core LDM, and gets the data of the MEM to the designated location of the LDM. The transmission mode is specified by mode. If it is in broadcast mode and broadcast line mode, mask register configuration is required; in other modes, the mask value is invalid.
params:
-
dma_mode mode: DMA transfer command mode;
-
void * src: DMA transfer main memory source address;
-
void * dest: DMA transfer local local storage target address;
-
int len: the amount of DMA transfer data, in bytes;
-
void * reply: DMA transfer reply word address, which must be the local storage address, address 4B is delimited;
-
char mask: DMA transmission broadcast effective vector, the effective granularity is one line in the core group, and a bit of 1 indicates that the corresponding line transmission is effective, which acts on the broadcast mode and the broadcast line mode;
-
int stride: main memory strides, in bytes;
-
int bsize: In line set mode, it must be configured to indicate the size of the data granularity on each slave core; in other modes, it is effective in DMA stride transfer, indicating the size of the DMA transfer stride vector block, in bytes For the unit.
-
return int: |
Success: 0 is returned.
Failure: Any other return value indicates an error. If any of the following conditions are monitored, athread_get will fail and return the corresponding value.
-EINVAL: Return failed with an exception.
eg: |
__thread_local long ldm_a [64];
__thread long mem_b [64];
__thread_local int reply = 0;
athread_get (PE_MODE, mem_a, ldm_a, 64 * 8, & reply, 0,0,0);
// In single-slave core mode, the private continuous segment of the slave core uses mem_a as the base address to take 64 * 8B data into the continuous 64 * 8B space with the ldm_a as the base address from the core office, where the broadcast vector and the main memory span The step and vector block sizes are both 0.
-
name: athread_put
header: slave.h
tags: [CPE]
cates: [Athread]
desc: |
Send data from the core LDM to the main memory MEM, perform a data put operation from the core LDM to the main memory MEM, and put the LDM data to the location specified by the MEM. The transmission mode is specified by mode and does not support broadcast mode and broadcast line mode.
For the DMA transfer command mode, refer to the additional description of the athread_get interface
params:
-
dma_mode mode: DMA transfer command mode;
-
void * src: DMA transfer local storage source address;
-
void * dest: DMA transfer main storage destination address;
-
int len: the amount of DMA transfer data, in bytes;
-
void * reply: DMA transfer reply word address, which must be the local storage address, address 4B is delimited;
-
int stride: main memory strides, in bytes;
-
int bsize: In line set mode, it must be configured to indicate the size of the data granularity on each slave core; in other modes, it is effective in DMA stride transfer, indicating the size of the DMA transfer stride vector block, in bytes For the unit.
-
return int: |
Success: 0 is returned.
Failure: Any other return value indicates an error. If any of the following conditions are detected, athread_put will fail and return the corresponding value.
-EINVAL: Return failed with an exception.
-
name: athread_get_p
header: slave.h
tags: [CPE]
cates: [Athread]
desc: |
Physical address data reception, except that the source main storage address is a physical address, other usage methods are consistent with athread_get
params:
-
dma_mode mode: DMA transfer command mode;
-
void * src: DMA transfer main memory source address;
-
void * dest: DMA transfer local local storage target address;
-
int len: the amount of DMA transfer data, in bytes;
-
void * reply: DMA transfer reply word address, which must be the local storage address, address 4B is delimited;
-
char mask: DMA transmission broadcast effective vector, the effective granularity is one line in the core group, and a bit of 1 indicates that the corresponding line transmission is effective, which acts on the broadcast mode and the broadcast line mode;
-
int stride: main memory strides, in bytes;
-
int bsize: In line set mode, it must be configured to indicate the size of the data granularity on each slave core; in other modes, it is effective in DMA stride transfer, indicating the size of the DMA transfer stride vector block, in bytes For the unit.
-
return int: |
Success: 0 is returned.
Failure: Any other return value indicates an error. If any of the following conditions are monitored, athread_get will fail and return the corresponding value.
-EINVAL: Return failed with an exception.
-
name: athread_put_p
header: slave.h
tags: [CPE]
cates: [Athread]
desc: |
The physical address data is sent. Except that the destination main storage address is a physical address, other usage methods are the same as athread_put
params:
-
dma_mode mode: DMA transfer command mode;
-
void * src: DMA transfer local storage source address;
-
void * dest: DMA transfer main storage destination address;
-
int len: the amount of DMA transfer data, in bytes;
-
void * reply: DMA transfer reply word address, which must be the local storage address, address 4B is delimited;
-
int stride: main memory strides, in bytes;
-
int bsize: In line set mode, it must be configured to indicate the size of the data granularity on each slave core; in other modes, it is effective in DMA stride transfer, indicating the size of the DMA transfer stride vector block, in bytes For the unit.
-
return int: |
Success: 0 is returned.
Failure: Any other return value indicates an error. If any of the following conditions are detected, athread_put will fail and return the corresponding value.
-EINVAL: Return failed with an exception.
-
name: athread_dma_barrier
header: slave.h
tags: [CPE]
cates: [Athread]
desc: |
Initiate dma fence, the corresponding dma command opcode is barrier_group
-
name: scope
params:
-
enum ROW_SCOPE: row synchronization, the lower 8 bits are valid
-
enum COL_SCOPE: column synchronization, the lower 8 bits are valid
-
enum ARRAY_SCOPE: full core group synchronization, the lower 16 bits are effective, of which the lower 8 bits of 16 bits are column synchronization mask codes and the upper 8 bits are row synchronization mask codes
-
return enum:
desc:
The synchronization domain of athread_syn.
-
name: athread_syn
header: slave.h
tags: [CPE]
cates: [Athread]
desc: |
The slave cores are controlled synchronously within the core group.
params:
-
scope scp: synchronization scope control
-
int mask: synchronous mask code
-
return int: |
Success: 0 is returned.
Failure: Any other return value indicates an error. If any of the following conditions are monitored, athread_syn will fail and return the corresponding value.
-EINVAL: Return failed with an exception.
-
name: get_allocatable_size
header: slave.h
tags: [CPE]
cates: [LDM Malloc]
desc: |
Get the current size of the LDM space that can be dynamically allocated, that is, the size of the LDM space managed by the local storage dynamic allocation runtime library
params:
-
return size_t:
-
name: ldm_malloc
header: slave.h
tags: [CPE]
cates: [LDM Malloc]
desc: |
Local storage space application.
params:
-
size_t size: size of space in bytes
-
return void *: |
Successfully returned the starting address of the allocated LDM space;
Failure to return NULL;
-
name: ldm_free
header: slave.h
tags: [CPE]
cates: [LDM Malloc]
desc: |
The local storage space is released, and the starting address of the free space is addr.
params:
-
void * addr: It must be the local storage address returned by ldm_malloc in a previous successful allocation;
-
size_t size: Shows the size of the specified free space, generally must match the size of ldm_malloc in the previous one
-
name: dma_mode
params:
-
enum PE_MODE: single slave core mode
-
enum BCAST_MODE: broadcast mode
-
enum ROW_MODE: row mode
-
enum BROW_MODE: broadcast line mode
-
enum RANK_MODE: row collection mode
-
return enum:
desc: DMA command mode used in data DMA.
-
name: dma_op
params:
-
enum DMA_PUT: store data from core to main memory
-
enum DMA_GET: get data from main memory from core
-
enum DMA_PUT_P: store data from core to main memory (physical address)
-
enum DMA_GET_P: get data from core from main memory (physical address)
-
enum DMA_BARRIER: DMA fence
-
return enum:
desc: DMA operation type.
-
name: dma_set_size
header: dma.h
tags: [CPE]
cates: [DMA]
params:
-
dma_desc * dma_d:
-
int size:
-
return void:
desc: |
Set the data transmission attribute of the dma descriptor.
Data transfer volume
eg: |
dma_set_size (dma_d, 256);
-
name: dma_set_reply
header: dma.h
tags: [CPE]
cates: [DMA]
params:
-
dma_desc * dma_d:
-
int * reply:
-
return void:
desc: |
Set the answer word attribute of the dma descriptor.
eg: |
__thread_local reply;
dma_set_reply (dma_d, & reply);
-
name: dma_set_op
header: dma.h
tags: [CPE]
cates: [DMA]
params:
-
dma_desc * dma_d:
-
dma_op op:
-
return void:
desc: |
Set the dma operation attribute of the dma descriptor.
eg: |
dma_set_op (dma_d, DMA_PUT);
-
name: dma_set_mode
header: dma.h
tags: [CPE]
cates: [DMA]
params:
-
dma_desc * dma_d:
-
dma_mode mode:
-
return void:
desc: Set the dma mode attribute of the dma descriptor.
eg: |
dma_set_op (dma_d, PE_MODE);
-
name: dma_set_mask
header: dma.h
tags: [CPE]
cates: [DMA]
params:
-
dma_desc * dma_d:
-
int mask:
-
return void:
desc: |
Set the mask code attribute of the dma descriptor.
Only for broadcast and broadcast line mode
eg: |
dma_set_mask (dma_d, 1);
-
name: dma_set_bsize
header: dma.h
tags: [CPE]
cates: [DMA]
params:
-
dma_desc * dma_d:
-
int bsize:
-
return void:
desc: |
Set the dma descriptor's stride vector block size attribute.
Only used in stride mode and row collection mode;
TODO in broadcast mode
In row set mode, bsize is the block size transferred to each slave core.
eg: |
dma_set_bsize (dma_d, 0x32);
-
name: dma_set_stepsize
header: dma.h
tags: [CPE]
cates: [DMA]
params:
-
dma_desc * dma_d:
-
int length:
desc: |
Set the main memory stride length attribute of the dma descriptor.
Only used in stride mode and row collection mode;
TODO in broadcast mode
eg: |
dma_set_stepsize (dma_d, 0x128);
-
name: dma
header: dma.h
tags: [CPE]
cates: [DMA]
params:
-
dma_desc dma_d:
-
long mem:
-
long ldm:
inst: dma
desc: |
Initiate dma according to the dma descriptor, main storage start address and local storage start address specified by the parameters
-
name: dma_wait
header: dma.h
tags: [CPE]
cates: [DMA]
params:
-
int * reply:
-
int count:
desc:
Wait according to the address of the answer word specified by the parameter until the value of the answer word is equal to count
-
name: dma_barrier
header: dma.h
tags: [CPE]
cates: [DMA]
inst: dma
desc:
Initiate the dma fence of this slave core
-
name: simd_load
desc: |
For extended type loading, 32 bytes (floatv4 type loading is 16 bytes) of data is loaded into a vector variable from the continuous memory area.
The memory address loaded must be 32 bytes aligned.
params:
-
intv8 va: the result is stored in va
-
int * addr: address to be loaded
cates: [SIMD, SIMD-load, SIMD-int]
tags: [CPE, MPE]
header: simd.h
inst: vldd
-
name: simd_load
desc: |
For extended type loading, 32 bytes (floatv4 type loading is 16 bytes) of data is loaded into a vector variable from the continuous memory area.
The memory address loaded must be 32 bytes aligned.
params:
-
doublev4 va: the result is stored in va
-
double * addr: address to be loaded
cates: [SIMD, SIMD-load, SIMD-dp]
tags: [CPE, MPE]
header: simd.h
inst: vldd
-