diff --git a/annotated.html b/annotated.html index 0de1eaee..221d2c16 100644 --- a/annotated.html +++ b/annotated.html @@ -175,18 +175,20 @@  Cpack_q4_tensor  Cpack_q8_tensor  Cpair_hash - CProfiler - Cquantization_params - CRotaryPosEmb - Cthread_args - Ctranspose_1_2idx_arg - Ctranspose_1_2idx_float_arg - CW8A8B8O8Linear - CW8A8B8O8Linear_params - CW8A8B8O8LinearReLU - CW8A8B8O8LinearReLU_params - CW8A8BFP32OFP32Linear - CW8A8BFP32OFP32Linear_params + Cpool + Cpool_queue + CProfiler + Cquantization_params + CRotaryPosEmb + Cthread_args + Ctranspose_1_2idx_arg + Ctranspose_1_2idx_float_arg + CW8A8B8O8Linear + CW8A8B8O8Linear_params + CW8A8B8O8LinearReLU + CW8A8B8O8LinearReLU_params + CW8A8BFP32OFP32Linear + CW8A8BFP32OFP32Linear_params diff --git a/classes.html b/classes.html index dc1a5ae6..612f28fa 100644 --- a/classes.html +++ b/classes.html @@ -103,7 +103,7 @@
opt_params
OPT_token_data
OPT_token_data_array
OPTForCausalLM
OPTForCausalLM_input
OPTForCausalLM_output
optimization_params
P
-
pack_q4_tensor
pack_q8_tensor
pair_hash
Profiler
+
pack_q4_tensor
pack_q8_tensor
pair_hash
pool
pool_queue
Profiler
Q
quantization_params
diff --git a/dir_d3fd84b2e4114076d2551689812cf799.html b/dir_d3fd84b2e4114076d2551689812cf799.html index 44ebec9e..eb26f537 100644 --- a/dir_d3fd84b2e4114076d2551689812cf799.html +++ b/dir_d3fd84b2e4114076d2551689812cf799.html @@ -94,6 +94,8 @@ Files  matmul.h   + pthread_pool.h diff --git a/files.html b/files.html index 216d1ed2..dd583d87 100644 --- a/files.html +++ b/files.html @@ -81,51 +81,52 @@  opParams.h  matmul_metal_int4_imp.h  matmul.h -  llm -  include -  nn_modules - Fp32llamaAttention.h - Fp32llamaDecoder.h - Fp32llamaDecoderLayer.h - Fp32llamaForCausalLM.h - Fp32OPTAttention.h - Fp32OPTDecoder.h - Fp32OPTDecoderLayer.h - Fp32OPTForCausalLM.h - Int4llamaAttention.h - Int4llamaDecoder.h - Int4llamaDecoderLayer.h - Int4llamaForCausalLM.h - Int4OPTAttention.h - Int4OPTDecoder.h - Int4OPTDecoderLayer.h - Int4OPTForCausalLM.h - Int8OPTAttention.h - Int8OPTDecoder.h - Int8OPTDecoderLayer.h - OPTForCausalLM.h -  ops - arg_max.h - BMM_F32T.h - BMM_S8T_S8N_F32T.h - BMM_S8T_S8N_S8T.h - Embedding.h - LayerNorm.h - LayerNormQ.h - linear.h - LlamaRMSNorm.h - RotaryPosEmb.h - W8A8B8O8Linear.h - W8A8B8O8LinearReLU.h - W8A8BFP32OFP32Linear.h - common.h - Generate.h - LLaMATokenizer.h - model.h - operators.h - OPTTokenizer.h - profiler.h - utils.h + pthread_pool.h +  llm +  include +  nn_modules + Fp32llamaAttention.h + Fp32llamaDecoder.h + Fp32llamaDecoderLayer.h + Fp32llamaForCausalLM.h + Fp32OPTAttention.h + Fp32OPTDecoder.h + Fp32OPTDecoderLayer.h + Fp32OPTForCausalLM.h + Int4llamaAttention.h + Int4llamaDecoder.h + Int4llamaDecoderLayer.h + Int4llamaForCausalLM.h + Int4OPTAttention.h + Int4OPTDecoder.h + Int4OPTDecoderLayer.h + Int4OPTForCausalLM.h + Int8OPTAttention.h + Int8OPTDecoder.h + Int8OPTDecoderLayer.h + OPTForCausalLM.h +  ops + arg_max.h + BMM_F32T.h + BMM_S8T_S8N_F32T.h + BMM_S8T_S8N_S8T.h + Embedding.h + LayerNorm.h + LayerNormQ.h + linear.h + LlamaRMSNorm.h + RotaryPosEmb.h + W8A8B8O8Linear.h + W8A8B8O8LinearReLU.h + W8A8BFP32OFP32Linear.h + common.h + Generate.h + LLaMATokenizer.h + model.h + operators.h + OPTTokenizer.h + profiler.h + utils.h diff --git a/globals.html b/globals.html new file mode 100644 index 00000000..2ec7e28d --- /dev/null +++ b/globals.html @@ -0,0 +1,84 @@ + + + + + + + +TinyChatEngine: File Members + + + + + + + + + +
+
+ + + + + + +
+
TinyChatEngine +
+
+
+ + + + + + + +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all documented file members with links to the documentation:
+
+ + + + diff --git a/globals_func.html b/globals_func.html new file mode 100644 index 00000000..c6def00d --- /dev/null +++ b/globals_func.html @@ -0,0 +1,84 @@ + + + + + + + +TinyChatEngine: File Members + + + + + + + + + +
+
+ + + + + + +
+
TinyChatEngine +
+
+
+ + + + + + + +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all documented functions with links to the documentation:
+
+ + + + diff --git a/menudata.js b/menudata.js index b7ed9175..8c84a84c 100644 --- a/menudata.js +++ b/menudata.js @@ -28,4 +28,7 @@ var menudata={children:[ {text:"Class List",url:"annotated.html"}, {text:"Class Index",url:"classes.html"}]}, {text:"Files",url:"files.html",children:[ -{text:"File List",url:"files.html"}]}]} +{text:"File List",url:"files.html"}, +{text:"File Members",url:"globals.html",children:[ +{text:"All",url:"globals.html"}, +{text:"Functions",url:"globals_func.html"}]}]}]} diff --git a/pthread__pool_8h.html b/pthread__pool_8h.html new file mode 100644 index 00000000..1beda8a7 --- /dev/null +++ b/pthread__pool_8h.html @@ -0,0 +1,224 @@ + + + + + + + +TinyChatEngine: kernels/pthread_pool.h File Reference + + + + + + + + + +
+
+ + + + + + +
+
TinyChatEngine +
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
+Functions
+
pthread_pool.h File Reference
+
+
+ +

Go to the source code of this file.

+ + + + + + + + + + +

+Functions

voidpool_start (void *(*thread_func)(void *), unsigned int threads)
 
void pool_enqueue (void *pool, void *arg, char free)
 
void pool_wait (void *pool)
 
void pool_end (void *pool)
 
+

Detailed Description

+

This file provides prototypes for an implementation of a pthread pool.

+

Function Documentation

+ +

◆ pool_end()

+ +
+
+ + + + + + + + +
void pool_end (voidpool)
+
+

Stop all threads in the pool.

+

Note that this function will block until all threads have terminated. All queued items will also be freed, along with the pool itself. Remaining work item arguments will be freed depending on the free argument to pool_enqueue.

+ +
+
+ +

◆ pool_enqueue()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void pool_enqueue (voidpool,
voidarg,
char free 
)
+
+

Enqueue a new task for the thread pool.

+
Parameters
+ + + + +
poolA thread pool returned by start_pool.
argThe argument to pass to the thread worker function.
freeIf true, the argument will be freed after the task has completed.
+
+
+ +
+
+ +

◆ pool_start()

+ +
+
+ + + + + + + + + + + + + + + + + + +
void * pool_start (void *(*)(void *) thread_func,
unsigned int threads 
)
+
+

Create a new thread pool.

+

New tasks should be enqueued with pool_enqueue. thread_func will be called once per queued task with its sole argument being the argument given to pool_enqueue.

+
Parameters
+ + + +
thread_funcThe function executed by each thread for each work item.
threadsThe number of threads in the pool.
+
+
+
Returns
A pointer to the thread pool.
+ +
+
+ +

◆ pool_wait()

+ +
+
+ + + + + + + + +
void pool_wait (voidpool)
+
+

Wait for all queued tasks to be completed.

+ +
+
+
+ + + + diff --git a/pthread__pool_8h_source.html b/pthread__pool_8h_source.html new file mode 100644 index 00000000..edf5145a --- /dev/null +++ b/pthread__pool_8h_source.html @@ -0,0 +1,106 @@ + + + + + + + +TinyChatEngine: kernels/pthread_pool.h Source File + + + + + + + + + +
+
+ + + + + + +
+
TinyChatEngine +
+
+
+ + + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
pthread_pool.h
+
+
+Go to the documentation of this file.
1
+
5#ifndef __PTHREAD_POOL_H__
+
17void * pool_start(void * (*thread_func)(void *), unsigned int threads);
+
18
+
26void pool_enqueue(void *pool, void *arg, char free);
+
27
+
31void pool_wait(void *pool);
+
32
+
41void pool_end(void *pool);
+
42
+
43#endif
+
void pool_enqueue(void *pool, void *arg, char free)
Definition pthread_pool.cc:46
+
void pool_wait(void *pool)
Definition pthread_pool.cc:62
+
void * pool_start(void *(*thread_func)(void *), unsigned int threads)
Definition pthread_pool.cc:26
+
void pool_end(void *pool)
Definition pthread_pool.cc:72
+
Definition pthread_pool.cc:12
+
+ + + + diff --git a/search/all_11.js b/search/all_11.js index 15ae96a5..02a9696d 100644 --- a/search/all_11.js +++ b/search/all_11.js @@ -3,8 +3,15 @@ var searchData= ['pack_5fq4_5ftensor_0',['pack_q4_tensor',['../structpack__q4__tensor.html',1,'']]], ['pack_5fq8_5ftensor_1',['pack_q8_tensor',['../structpack__q8__tensor.html',1,'']]], ['pair_5fhash_2',['pair_hash',['../structpair__hash.html',1,'']]], - ['prerequisites_3',['Prerequisites',['../index.html#autotoc_md7',1,'']]], - ['pro_20m1_202021_20_3a_4',['Demo on an Apple MacBook Pro (M1, 2021):',['../index.html#autotoc_md2',1,'']]], - ['profiler_5',['Profiler',['../classProfiler.html',1,'']]], - ['projects_6',['Related Projects',['../index.html#autotoc_md18',1,'']]] + ['pool_3',['pool',['../structpool.html',1,'']]], + ['pool_5fend_4',['pool_end',['../pthread__pool_8h.html#a7ed215fb1f5e6933bf970bf089a16e5c',1,'pthread_pool.cc']]], + ['pool_5fenqueue_5',['pool_enqueue',['../pthread__pool_8h.html#a25a373d27638bc2b8532edfe6ab056ba',1,'pthread_pool.cc']]], + ['pool_5fqueue_6',['pool_queue',['../structpool__queue.html',1,'']]], + ['pool_5fstart_7',['pool_start',['../pthread__pool_8h.html#a414561dad8af7224cdbd531e3d9e4a0a',1,'pthread_pool.cc']]], + ['pool_5fwait_8',['pool_wait',['../pthread__pool_8h.html#a314c9adaec7a7ad64fe9e5b8bfa3fbd1',1,'pthread_pool.cc']]], + ['prerequisites_9',['Prerequisites',['../index.html#autotoc_md7',1,'']]], + ['pro_20m1_202021_20_3a_10',['Demo on an Apple MacBook Pro (M1, 2021):',['../index.html#autotoc_md2',1,'']]], + ['profiler_11',['Profiler',['../classProfiler.html',1,'']]], + ['projects_12',['Related Projects',['../index.html#autotoc_md18',1,'']]], + ['pthread_5fpool_2eh_13',['pthread_pool.h',['../pthread__pool_8h.html',1,'']]] ]; diff --git a/search/classes_9.js b/search/classes_9.js index 9bb4a4bf..5e1760ac 100644 --- a/search/classes_9.js +++ b/search/classes_9.js @@ -3,5 +3,7 @@ var searchData= ['pack_5fq4_5ftensor_0',['pack_q4_tensor',['../structpack__q4__tensor.html',1,'']]], ['pack_5fq8_5ftensor_1',['pack_q8_tensor',['../structpack__q8__tensor.html',1,'']]], ['pair_5fhash_2',['pair_hash',['../structpair__hash.html',1,'']]], - ['profiler_3',['Profiler',['../classProfiler.html',1,'']]] + ['pool_3',['pool',['../structpool.html',1,'']]], + ['pool_5fqueue_4',['pool_queue',['../structpool__queue.html',1,'']]], + ['profiler_5',['Profiler',['../classProfiler.html',1,'']]] ]; diff --git a/search/files_0.js b/search/files_0.js new file mode 100644 index 00000000..86988d30 --- /dev/null +++ b/search/files_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['pthread_5fpool_2eh_0',['pthread_pool.h',['../pthread__pool_8h.html',1,'']]] +]; diff --git a/search/functions_0.js b/search/functions_0.js new file mode 100644 index 00000000..7f4d67e8 --- /dev/null +++ b/search/functions_0.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['pool_5fend_0',['pool_end',['../pthread__pool_8h.html#a7ed215fb1f5e6933bf970bf089a16e5c',1,'pthread_pool.cc']]], + ['pool_5fenqueue_1',['pool_enqueue',['../pthread__pool_8h.html#a25a373d27638bc2b8532edfe6ab056ba',1,'pthread_pool.cc']]], + ['pool_5fstart_2',['pool_start',['../pthread__pool_8h.html#a414561dad8af7224cdbd531e3d9e4a0a',1,'pthread_pool.cc']]], + ['pool_5fwait_3',['pool_wait',['../pthread__pool_8h.html#a314c9adaec7a7ad64fe9e5b8bfa3fbd1',1,'pthread_pool.cc']]] +]; diff --git a/search/searchdata.js b/search/searchdata.js index 1272829c..689b3877 100644 --- a/search/searchdata.js +++ b/search/searchdata.js @@ -2,20 +2,26 @@ var indexSectionsWithContent = { 0: "247:abcdefghilmnopqrstvwyz", 1: "abcefilmopqrtw", - 2: "t" + 2: "p", + 3: "p", + 4: "t" }; var indexSectionNames = { 0: "all", 1: "classes", - 2: "pages" + 2: "files", + 3: "functions", + 4: "pages" }; var indexSectionLabels = { 0: "All", 1: "Classes", - 2: "Pages" + 2: "Files", + 3: "Functions", + 4: "Pages" }; diff --git a/structpool-members.html b/structpool-members.html new file mode 100644 index 00000000..4bbf3dd4 --- /dev/null +++ b/structpool-members.html @@ -0,0 +1,93 @@ + + + + + + + +TinyChatEngine: Member List + + + + + + + + + +
+
+ + + + + + +
+
TinyChatEngine +
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+
pool Member List
+
+
+ +

This is the complete list of members for pool, including all inherited members.

+ + + + + + + + + + +
cancelled (defined in pool)pool
end (defined in pool)pool
fn (defined in pool)pool
nthreads (defined in pool)pool
q (defined in pool)pool
q_cnd (defined in pool)pool
q_mtx (defined in pool)pool
remaining (defined in pool)pool
threads (defined in pool)pool
+ + + + diff --git a/structpool.html b/structpool.html new file mode 100644 index 00000000..46ac6db1 --- /dev/null +++ b/structpool.html @@ -0,0 +1,118 @@ + + + + + + + +TinyChatEngine: pool Struct Reference + + + + + + + + + +
+
+ + + + + + +
+
TinyChatEngine +
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+
+Public Attributes | +List of all members
+
pool Struct Reference
+
+
+ + + + + + + + + + + + + + + + + + + + +

+Public Attributes

+char cancelled
 
+void *(* fn )(void *)
 
+unsigned int remaining
 
+unsigned int nthreads
 
+struct pool_queueq
 
+struct pool_queueend
 
+pthread_mutex_t q_mtx
 
+pthread_cond_t q_cnd
 
+pthread_t threads [1]
 
+
The documentation for this struct was generated from the following file: +
+ + + + diff --git a/structpool__queue-members.html b/structpool__queue-members.html new file mode 100644 index 00000000..ae4e62e5 --- /dev/null +++ b/structpool__queue-members.html @@ -0,0 +1,87 @@ + + + + + + + +TinyChatEngine: Member List + + + + + + + + + +
+
+ + + + + + +
+
TinyChatEngine +
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+
pool_queue Member List
+
+
+ +

This is the complete list of members for pool_queue, including all inherited members.

+ + + + +
arg (defined in pool_queue)pool_queue
free (defined in pool_queue)pool_queue
next (defined in pool_queue)pool_queue
+ + + + diff --git a/structpool__queue.html b/structpool__queue.html new file mode 100644 index 00000000..20eafa7f --- /dev/null +++ b/structpool__queue.html @@ -0,0 +1,100 @@ + + + + + + + +TinyChatEngine: pool_queue Struct Reference + + + + + + + + + +
+
+ + + + + + +
+
TinyChatEngine +
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
+
+Public Attributes | +List of all members
+
pool_queue Struct Reference
+
+
+ + + + + + + + +

+Public Attributes

+voidarg
 
+char free
 
+struct pool_queuenext
 
+
The documentation for this struct was generated from the following file: +
+ + + +