Rev 154 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 154 | Rev 156 | ||
|---|---|---|---|
| Line 299... | Line 299... | ||
| 299 | best_interest = -999999; |
299 | best_interest = -999999; |
| 300 | join_block = 0; |
300 | join_block = 0; |
| 301 | for (current = 0; current <= smp_max_threads * 64; current++) { |
301 | for (current = 0; current <= smp_max_threads * 64; current++) { |
| 302 | tree = block[current]; |
302 | tree = block[current]; |
| 303 | if (tree->joinable && (tree->ply <= tree->depth / 2 || |
303 | if (tree->joinable && (tree->ply <= tree->depth / 2 || |
| 304 | tree->nprocs < smp_split_group) && tree->thread_id != tid) { |
304 | tree->nprocs < (int) smp_split_group) && tree->thread_id != tid) { // Pierre-Marie Baty -- added type cast |
| 305 | interest = tree->depth * 2 - tree->searched[0]; |
305 | interest = tree->depth * 2 - tree->searched[0]; |
| 306 | if (interest > best_interest) { |
306 | if (interest > best_interest) { |
| 307 | best_interest = interest; |
307 | best_interest = interest; |
| 308 | join_block = tree; |
308 | join_block = tree; |
| 309 | } |
309 | } |
| Line 344... | Line 344... | ||
| 344 | ************************************************************ |
344 | ************************************************************ |
| 345 | */ |
345 | */ |
| 346 | if (join_block) { |
346 | if (join_block) { |
| 347 | Lock(join_block->lock); |
347 | Lock(join_block->lock); |
| 348 | if (join_block->joinable) { |
348 | if (join_block->joinable) { |
| 349 | child = GetBlock(join_block, tid); |
349 | child = GetBlock(join_block, (int) tid); // Pierre-Marie Baty -- added type cast |
| 350 | Unlock(join_block->lock); |
350 | Unlock(join_block->lock); |
| 351 | if (child) { |
351 | if (child) { |
| 352 | CopyFromParent(child); |
352 | CopyFromParent(child); |
| 353 | thread[tid].tree = child; |
353 | thread[tid].tree = child; |
| 354 | parallel_joins++; |
354 | parallel_joins++; |
| Line 449... | Line 449... | ||
| 449 | * thread becomes idle, it will find these split points immediately and not * |
449 | * thread becomes idle, it will find these split points immediately and not * |
| 450 | * have to wait for a split after the fact. * |
450 | * have to wait for a split after the fact. * |
| 451 | * * |
451 | * * |
| 452 | ******************************************************************************* |
452 | ******************************************************************************* |
| 453 | */ |
453 | */ |
| 454 | int ThreadSplit(TREE * tree, int ply, int depth, int alpha, int o_alpha, |
454 | int ThreadSplit(TREE *RESTRICT tree, int ply, int depth, int alpha, int o_alpha, // Pierre-Marie Baty -- missing RESTRICT keyword |
| 455 | int done) { |
455 | int done) { |
| 456 | TREE *used; |
456 | TREE *used; |
| 457 | int64_t tblocks; |
457 | int64_t tblocks; |
| 458 | int temp, unused = 0; |
458 | int temp, unused = 0; |
| 459 | 459 | ||
| Line 464... | Line 464... | ||
| 464 | * split point, that being that we must not be too far * |
464 | * split point, that being that we must not be too far * |
| 465 | * from the root (smp_min_split_depth). * |
465 | * from the root (smp_min_split_depth). * |
| 466 | * * |
466 | * * |
| 467 | ************************************************************ |
467 | ************************************************************ |
| 468 | */ |
468 | */ |
| 469 | if (depth < smp_min_split_depth) |
469 | if (depth < (int) smp_min_split_depth) // Pierre-Marie Baty -- added type cast |
| 470 | return 0; |
470 | return 0; |
| 471 | /* |
471 | /* |
| 472 | ************************************************************ |
472 | ************************************************************ |
| 473 | * * |
473 | * * |
| 474 | * If smp_split is NOT set, we are checking to see if it * |
474 | * If smp_split is NOT set, we are checking to see if it * |
| Line 490... | Line 490... | ||
| 490 | * just add to the overhead with no benefit. * |
490 | * just add to the overhead with no benefit. * |
| 491 | * * |
491 | * * |
| 492 | ************************************************************ |
492 | ************************************************************ |
| 493 | */ |
493 | */ |
| 494 | if (!smp_split) { |
494 | if (!smp_split) { |
| 495 | if (depth < smp_gratuitous_depth || done > 1) |
495 | if (depth < (int) smp_gratuitous_depth || done > 1) // Pierre-Marie Baty -- added type cast |
| 496 | return 0; |
496 | return 0; |
| 497 | tblocks = ~thread[tree->thread_id].blocks; |
497 | tblocks = ~thread[tree->thread_id].blocks; |
| 498 | while (tblocks) { |
498 | while (tblocks) { |
| 499 | temp = LSB(tblocks); |
499 | temp = LSB(tblocks); |
| 500 | used = block[temp + tree->thread_id * 64 + 1]; |
500 | used = block[temp + tree->thread_id * 64 + 1]; |
| 501 | if (used->joinable && !used->joined) |
501 | if (used->joinable && !used->joined) |
| 502 | unused++; |
502 | unused++; |
| 503 | Clear(temp, tblocks); |
503 | Clear(temp, tblocks); |
| 504 | } |
504 | } |
| 505 | if (unused > smp_gratuitous_limit) |
505 | if (unused > (int) smp_gratuitous_limit) // Pierre-Marie Baty -- added type cast |
| 506 | return 0; |
506 | return 0; |
| 507 | } |
507 | } |
| 508 | /* |
508 | /* |
| 509 | ************************************************************ |
509 | ************************************************************ |
| 510 | * * |
510 | * * |
| Line 533... | Line 533... | ||
| 533 | used = block[temp + tree->thread_id * 64 + 1]; |
533 | used = block[temp + tree->thread_id * 64 + 1]; |
| 534 | if (used->joinable && !used->joined) |
534 | if (used->joinable && !used->joined) |
| 535 | unused++; |
535 | unused++; |
| 536 | Clear(temp, tblocks); |
536 | Clear(temp, tblocks); |
| 537 | } |
537 | } |
| 538 | if (unused > smp_gratuitous_limit) |
538 | if (unused > (int) smp_gratuitous_limit) // Pierre-Marie Baty -- added type cast |
| 539 | return 0; |
539 | return 0; |
| 540 | } |
540 | } |
| 541 | return 1; |
541 | return 1; |
| 542 | } |
542 | } |
| 543 | 543 | ||
| Line 985... | Line 985... | ||
| 985 | */ |
985 | */ |
| 986 | extern void *WinMalloc(size_t, int); |
986 | extern void *WinMalloc(size_t, int); |
| 987 | void ThreadMalloc(int64_t tid) { |
987 | void ThreadMalloc(int64_t tid) { |
| 988 | int i; |
988 | int i; |
| 989 | 989 | ||
| 990 | for (i = tid * 64 + 1; i < tid * 64 + 65; i++) { |
990 | for (i = (int) (tid * 64 + 1); i < (int) (tid * 64 + 65); i++) { // Pierre-Marie Baty -- added type casts |
| 991 | if (block[i] == NULL) |
991 | if (block[i] == NULL) |
| 992 | block[i] = |
992 | block[i] = |
| 993 | (TREE *) ((~(size_t) 127) & (127 + (size_t) WinMalloc(sizeof(TREE) + |
993 | (TREE *) ((~(size_t) 127) & (127 + (size_t) WinMalloc(sizeof(TREE) + |
| 994 | 127, tid))); |
994 | 127, (int) tid))); // Pierre-Marie Baty -- added type cast |
| 995 | block[i]->parent = NULL; |
995 | block[i]->parent = NULL; |
| 996 | LockInit(block[i]->lock); |
996 | LockInit(block[i]->lock); |
| 997 | } |
997 | } |
| 998 | } |
998 | } |
| 999 | #endif |
999 | #endif |