Re: [Gems-users] TM - runtime error


Date: 10 Sep 2009 15:36:43 -0500
From: holey003@xxxxxxx
Subject: Re: [Gems-users] TM - runtime error
I have added few comments but not modified functionality. Please find the source code attached. I can see print messages I have added in 'while' loops but not able to see any transactions happening. That's why I think magic calls are not working.

And I have cross checked all the flags set. Attaching rubyconfig.defaults for reference. (this is reply to another thread).

Thanks,
Anup

On Sep 10 2009, Polina Dudnik wrote:

Well, here's what I think: the number of threads for conswitch must not be
very straightforward, so when you specify 3, it probably never gets to the
part of the program where transactions are.

The script must be right and I was wrong.

So, now that I look at it, I know what the problem is. Look at this message:

End exposed action for thread 0 of proc 3 PC [0x11728, line 0x11700]
36500 3 [3,0] endEscapeAction WARNING escape depth < 1. Depth = 0
val = 6

What it is telling you is that you are ending an escape action without
having started it.

Did you modify the source code for conswitch in any way?

Thank you.

Polina

On Thu, Sep 10, 2009 at 2:55 PM, <holey003@xxxxxxx> wrote:

Ok.. But I got this value from conswtch.simics script where no. of threads
are 2*processors-2. If I make it 3, I can't see debug messages for
transactions, which means callback to simics from benchmark having those
macros, e.g. BEGIN_WORKLOAD_TRANSACTION, are not working. Why would they
work when number of threads are more?

-Anup

On Sep 10 2009, Polina Dudnik wrote:

> You can't run 6 threads on 4 processors because TM threads need to > bind to
>processors, plus there needs to be an extra processor for OS. So, 6
threads
>would run on 7+ processors.
>
>On Tue, Sep 8, 2009 at 3:08 PM, <holey003@xxxxxxx> wrote:
>
>> Hi,
>>
>> I am running 'conswtch' benchmark with 6 threads and 100 transactions.
>> I am
>> simulating a 4-core machine. I got following error while running the
>> code.
>>
>> Turning I-STC off and flushing old data
>> Turning D-STC off and flushing old data
>> D-STC is currently *OFF*
>> I-STC is currently *OFF*
>> Deprecation warning: variable assignment without variable prefix $.
>> cpu0: no-instruction-fetch
>> cpu1: no-instruction-fetch
>> cpu2: no-instruction-fetch
>> cpu3: no-instruction-fetch
>> Caught time breakpoint
>> successful installation of the ruby timing model.
>> Ruby Timing Mode
>> Creating event queue...
>> Creating event queue done
>> Creating system...
>>  Processors: 4
>> Creating system done
>> Ruby initialization complete
>> val = 7
>> End exposed action for thread 0 of proc 3 PC [0x11728, line 0x11700]
>> 36500 3 [3,0] endEscapeAction WARNING escape depth < 1. Depth = 0
>> val = 6
>> Begin exposed action for thread 0 of proc 3 PC [0x116f0, line 0x116c0]
>>  38250 3 [3,0] Begin ESCAPE ACTION - ESCAPE DEPTH: 1 PC [0x116f0, line
>> 0x116c0]
>> val = 7
>> End exposed action for thread 0 of proc 3 PC [0x11728, line 0x11700]
>>  183000 3 [3,0] END ESCAPE ACTION - ESCAPE DEPTH: 0 PC [0x11728, line
>> 0x11700]
>> val = 6
>> Begin exposed action for thread 0 of proc 3 PC [0x116f0, line 0x116c0]
>> 184750 3 [3,0] Begin ESCAPE ACTION - ESCAPE DEPTH: 1 PC [0x116f0, >> line
>> 0x116c0]
>> val = 7
>> End exposed action for thread 0 of proc 3 PC [0x11728, line 0x11700]
>>  329500 3 [3,0] END ESCAPE ACTION - ESCAPE DEPTH: 0 PC [0x11728, line
>> 0x11700]
>> val = 6
>> Begin exposed action for thread 0 of proc 3 PC [0x116f0, line 0x116c0]
>> 331250 3 [3,0] Begin ESCAPE ACTION - ESCAPE DEPTH: 1 PC [0x116f0, >> line
>> 0x116c0]
>> val = 7
>> End exposed action for thread 0 of proc 3 PC [0x11728, line 0x11700]
>>  476000 3 [3,0] END ESCAPE ACTION - ESCAPE DEPTH: 0 PC [0x11728, line
>> 0x11700]
>> val = 6
>> Begin exposed action for thread 0 of proc 3 PC [0x116f0, line 0x116c0]
>> 477750 3 [3,0] Begin ESCAPE ACTION - ESCAPE DEPTH: 1 PC [0x116f0, >> line
>> 0x116c0]
>> val = 7
>> End exposed action for thread 0 of proc 3 PC [0x11728, line 0x11700]
>>  622500 3 [3,0] END ESCAPE ACTION - ESCAPE DEPTH: 0 PC [0x11728, line
>> 0x11700]
>> val = 6
>> Begin exposed action for thread 0 of proc 3 PC [0x116f0, line 0x116c0]
>> 624250 3 [3,0] Begin ESCAPE ACTION - ESCAPE DEPTH: 1 PC [0x116f0, >> line
>> 0x116c0]
>> val = 7
>> End exposed action for thread 0 of proc 3 PC [0x11728, line 0x11700]
>>  769000 3 [3,0] END ESCAPE ACTION - ESCAPE DEPTH: 0 PC [0x11728, line
>> 0x11700]
>> val = 6
>> Begin exposed action for thread 0 of proc 3 PC [0x116f0, line 0x116c0]
>> 770750 3 [3,0] Begin ESCAPE ACTION - ESCAPE DEPTH: 1 PC [0x116f0, >> line
>> 0x116c0]
>> val = 7
>> End exposed action for thread 0 of proc 3 PC [0x11728, line 0x11700]
>>  915500 3 [3,0] END ESCAPE ACTION - ESCAPE DEPTH: 0 PC [0x11728, line
>> 0x11700]
>> val = 6
>> Begin exposed action for thread 0 of proc 3 PC [0x116f0, line 0x116c0]
>> 917250 3 [3,0] Begin ESCAPE ACTION - ESCAPE DEPTH: 1 PC [0x116f0, >> line
>> 0x116c0]
>> val = 7
>> End exposed action for thread 0 of proc 3 PC [0x11728, line 0x11700]
>>  1062000 3 [3,0] END ESCAPE ACTION - ESCAPE DEPTH: 0 PC [0x11728, line
>> 0x11700]
>> val = 6
>> Begin exposed action for thread 0 of proc 3 PC [0x116f0, line 0x116c0]
>> 1063750 3 [3,0] Begin ESCAPE ACTION - ESCAPE DEPTH: 1 PC [0x116f0, >> line
>> 0x116c0]
>> val = 7
>> End exposed action for thread 0 of proc 3 PC [0x11728, line 0x11700]
>>  1208500 3 [3,0] END ESCAPE ACTION - ESCAPE DEPTH: 0 PC [0x11728, line
>> 0x11700]
>> val = 2048
>> Commit CLOSED transaction for thread 0 of proc 3 XID 0
>> commitTransaction ERROR NOT IN XACT proc =3 logical_proc = 3 xid = 0
>> isOpen
>> = 0 tid = -1 pc = [0x11788, line 0x11780] level = 0 time = 1210500
>> simics-common: log_tm/TransactionInterfaceManager.C:243: void
>> TransactionInterfaceManager::commitTransaction(int, int, bool):
Assertion
>> `m_transactionLevel[thread] >= 1' failed.
>> Abort (SIGABRT) in main thread
>> The simulation state has been corrupted. Simulation cannot continue.
>> Please restart Simics.
>> Starting command line. (May have skipped commands in script files.)
>> [cpu3] v:0x0000000000011788 p:0x00026085788  magic (sethi 0x800, %g0)
>> Setting new inspection cpu: cpu3
>>
>>
>> What does m_escapeDepth store?
>> Also it is always showing 'thread 0 of proc 3'. How can I assure if >> each
>> thread is bound to processor? I am using commands
>> con0.input "psrset -c 1 \n"
>> con0.input "psrset -c 2 \n"
>> con0.input "psrset -c 3 \n"
>> before running the benchmark.
>>
>>
>> Thanks,
>> Anup
>> _______________________________________________
>> Gems-users mailing list
>> Gems-users@xxxxxxxxxxx
>> https://lists.cs.wisc.edu/mailman/listinfo/gems-users
>> Use Google to search the GEMS Users mailing list by adding "site:
>> https://lists.cs.wisc.edu/archive/gems-users/"; to your search.
>>
>>
>
_______________________________________________
Gems-users mailing list
Gems-users@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/gems-users
Use Google to search the GEMS Users mailing list by adding "site:
https://lists.cs.wisc.edu/archive/gems-users/"; to your search.


#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <sys/time.h>
#include <sys/processor.h>
#include <sys/types.h>
#include <assert.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sched.h>
#include "transaction.h"
#include <sys/pset.h>
#include <strings.h>

/* NOTE: This microbenchmark has been tested with OpenSolaris b.33 */

void printDebugMsg(unsigned int val1, unsigned int val2, unsigned int val3, unsigned int tobreak)
{
  asm(".volatile");
  asm("sethi 8001, %g0");
  asm(".nonvolatile");
}

pthread_t *threads;
pthread_attr_t pthread_custom_attr;
int num_ops;
int num_threads;

struct {
	char pad[32];
	unsigned long long value;
	char pad2[30];
}	global_counter;

volatile int dummy;

void MAGIC_CALL_resolve_summary_conflict(unsigned int pid, unsigned int tid, unsigned int addr, unsigned int type) {
  asm(".volatile");
  asm("sethi 42, %g0");
  asm(".nonvolatile");
}

void MAGIC_CALL_get_summary_conflict_info(unsigned int *addr, unsigned int *type)
{
  asm(".volatile");
  asm(".register %g2,#scratch");
  asm(".register %g3,#scratch");
  asm("sethi 41, %g0");
  asm("st %g2, [%i0]");
  asm("st %g3, [%i1]");
  asm(".nonvolatile");
}

void handle_summary_conflict(int threadID) 
{
	unsigned int type, addr;
	MAGIC_CALL_get_summary_conflict_info(&addr, &type);
	MAGIC_CALL_resolve_summary_conflict(0, 0, addr, type);
}

void 
slaveLoop(void *id)
{
	int myid = *((int*)id);
    printf("%d :Slaveloop called\n",myid);
  unsigned int i, j, ret;
  int local_sense = 0;
	char localbuf[1024];
	unsigned int input_array[6];
	int mybinding;
	unsigned long long cycle;

	tm_bind_to_cabinet((myid%(num_threads/2))+1);
	Barrier(&local_sense, myid, num_threads);

	if (myid > num_threads/2-1) {
		BEGIN_ESCAPE
			while(1) {	
    printf("%d :slaveloop:if\n",myid);
				thr_yield();
			}
		END_ESCAPE
	} else {
		set_handler_address();
		set_log_base(myid);

		while (1) {
    printf("%d :slaveloop:else\n",myid);
			BEGIN_WORKLOAD_TRANSACTION
			BEGIN_CLOSED_TRANSACTION(0)
				global_counter.value = 0;
				for (i=0;i<10;i++) { 
					global_counter.value++;
					BEGIN_ESCAPE
						for (j=0;j<128;j++);
						thr_yield();
					END_ESCAPE
				}
				SIMICS_ASSERT(global_counter.value == 10);
			COMMIT_CLOSED_TRANSACTION(0)
			END_WORKLOAD_TRANSACTION
			for (i=0;i<1024;i++);
		}
	}
    printf("%d :slaveloop FINISHED\n",myid);
}

int main(int argc, char **argv){
		int n,i,j;
		int	*ids;
		hrtime_t  StartTime;
		hrtime_t  EndTime;  
		
		if (argc != 3)
		{
			printf ("Usage: %s n d\n  where n is no. of threads, d no. of ops\n",argv[0]);
			exit(1);
		}
		
		num_threads = atoi(argv[1]);
		num_ops = atoi(argv[2]);
		srandom(num_ops);
		threads = (pthread_t *) malloc(num_threads*sizeof(*threads));
		ids = (int*)calloc(num_threads, sizeof(int));
		pthread_attr_init(&pthread_custom_attr);
    pthread_attr_setscope(&pthread_custom_attr, PTHREAD_SCOPE_SYSTEM);
		
    Barrier_init();
    init_transaction_logs(num_threads);
		tm_init_summary_signature_conflict_handlers();
		tm_register_summary_signature_conflict_handler(handle_summary_conflict);

		StartTime = gethrtime(); 		
    printf("Creating threads...\n");
        
    for (i=0; i< num_threads - 1; i++)
		{
			ids[i] = i;	
            printf("i = %d\n",i);
			pthread_create(&threads[i], &pthread_custom_attr, slaveLoop, (void *)(ids+i));
		}
        
    printf("created threads ...\n");
    printf("i after thrd create = %d\n",i);
    ids[i] = num_threads - 1;
    printf("Calling slaveloop with %d\n",*(ids+i));
    slaveLoop(ids+i);
    printf("Slaveloop finished\n");

		/* Synchronize the completion of each thread. */
		for (i=0; i<num_threads - 1; i++){
			pthread_join(threads[i],NULL);
		}
		EndTime = gethrtime();
		
		printf("Time = %lld nanoseconds\n", EndTime - StartTime);
		return 0;
}

Attachment: rubyconfig.defaults
Description: rubyconfig.defaults

[← Prev in Thread] Current Thread [Next in Thread→]